B4J Question [ABMaterial] ABMTableMutable with varying number of ABMInput components problem

Robert Maguire

Member
Licensed User
Longtime User
Hi,
As my webapp starts to take shape I've come across a problem that I just cannot solve with ABMTableMutable and ABMInput components...​
Basically I have a page with two ABMCombo's and an ABMTableMutable.​
  • The number of rows in the table can vary depending on the value selected in Combo2.
  • Each row in the table contains an ABMInput in the first cell.
  • When Combo2 changes I have no problem have no problem clearing the table of rows and adding the rows with their ABMInput. Both the Row and the ABMInput have their own unique id's.
    • One curious thing about the ABMInput's is that I apply an InputMask but that InputMask does not seem to be active even though it shows when I inspect it at runtime.
  • When Combo1 changes I need to run through each row and set the ABMInput.Text value to "", i.e. wiping the value in each ABMInput so the user can start again.
The problem is that if try to do a logDebug show of the ABMInput.Text value for a particular instance, it throws an exception. If I inspect the ABMInput using a breakpoint, the ABMInput seems to be there and I can see the specific Title and InputMask values but the Text value is either null or empty (even though a value has been entered on the page).

The code I use to clear the table (tblR) is (ignore tblA and tblI...they're for later):

Please Note:
wipe - a boolean to either delete the rows. False works... True is the problem; and at this point I'm not trying to loop through all rows, just clear the first row input by hard-coding the ids.

Clear the table:
Sub ClearResultsTables(wipe As Boolean)
    Dim tblA As ABMTableMutable = GetRRTableMutable(CMP_TAB_PAGE, CMP_TBP_RR, CMP_TBL_RR_ACCURACY)
    Dim tblI As ABMTableMutable = GetRRTableMutable(CMP_TAB_PAGE, CMP_TBP_RR, CMP_TBL_RR_IDEAL_SPLITS)
    Dim tblR As ABMTableMutable = GetRRTableMutable(CMP_TAB_PAGE, CMP_TBP_RR, CMP_TBL_RR_RESULTS)
    If wipe Then
        Dim id As String = CMP_INP_RR_TIME & 1
        Dim RowId As String = CMP_ROW_RR_RESULTS & 1
        Dim inp As ABMInput = tblR.GetComponent(RowId, id)
        LogDebug("Clearing Row: " & RowId & "     Input: " & id)
        Dim s As String = inp.Text
        LogDebug("Text = " & s)
        inp.Text = ""
    Else
        tblA.Clear
        tblA.SetFooters(Array As String("", ""))
        tblI.Clear
        tblI.SetFooters(Array As String(""))
        tblR.Clear
        tblR.SetFooters(Array As String(""))
    End If
    tblA.Refresh
    tblI.Refresh
    tblR.Refresh
End Sub

The code for creating the ABMInputs is:

Create the Inputs...:
Sub CreateInputs
    Dim prevRowId As String
    prevRowId = ""
    Dim tblR As ABMTableMutable = GetRRTableMutable(CMP_TAB_PAGE, CMP_TBP_RR, CMP_TBL_RR_RESULTS)
    For idx = 1 To (RRDistance / 50)
        Dim inp As ABMInput
        Dim id As String = CMP_INP_RR_TIME & idx
        inp.InitializeWithSize(page, id, ABM.INPUT_TEXT, (idx * 50) & "m", 100, 100, 100, 50, 50, 50, False, ABMShared.THM_INPUT)
        inp.inputMask = "'mask': '99:99.99'"
        inp.Text = ""
        inp.Narrow = True
        Dim rowId As String = CMP_ROW_RR_RESULTS & idx
        tblR.InsertRowAfter(prevRowId,rowId,Array As Object(inp), Array As String(""))
        prevRowId = rowId
        LogDebug("Creating Row: " & rowId & "     Input: " & CMP_INP_RR_TIME & idx)
    Next
    tblR.Refresh
End Sub

I use some constants plus the loop index to generate the id's for the rows and ABMInputs.

Here are two screenshots...one shows the debug view and the other is a screenshot of what is on the page...
Debug.PNG


Screenshot.PNG


Can anyone tell me where I'm going wrong here?

Thanks in advance...
 
Top