Hi to all
a bit of practice to learn more ABMaterial framework (thanks Harris for your tutorial).
I have a page "Home" with this code (a part of the code)
here appears the error:
This the error:
at com.ab.abmaterial.ABMTable.AddRow(Unknown Source)
If i comment this lines the Table is displayed.
Thanks for your help.
a bit of practice to learn more ABMaterial framework (thanks Harris for your tutorial).
I have a page "Home" with this code (a part of the code)
B4X:
public Sub ConnectPage()
' connecting the navigation bar
ABMShared.ConnectNavigationBar(page)
' refresh the page
page.Refresh
' Tell the browser we finished loading
page.FinishedLoading
' restoring the navigation bar position
page.RestoreNavigationBarPosition
page.NavigationBar.Refresh
End Sub
Sub Page_NavigationbarClicked(Action As String, Value As String)
' saving the navigation bar position
page.SaveNavigationBarPosition
If Action = "LogOff" Then
ABMShared.LogOff(page)
Return
End If
Select Action
Case "Contact"
ShowMessage("Licenza: " & ws.Session.GetAttribute("licenza"), "Info Utente-Licenza")
Return
Case "Clienti"
SetTableClienti
End Select
'ABMShared.NavigateToPage(page.ws, ABMPageId, Value)'"../")
End Sub
Sub SetTableClienti
page.Row(1).RemoveAllComponents
page.Row(2).RemoveAllComponents
'input search in DB
Dim searchClient As ABMInput
searchClient.Initialize(page, "CercaCliente", ABM.INPUT_TEXT, "Cerca Cliente", False, "lightblue")
page.Cell(1,1).AddComponent(searchClient)
'
'Button search
Dim btnSearch As ABMButton
btnSearch.InitializeFloating(page, "btnSearch", "mdi-action-search", "")
page.Cell(1,7).AddComponent(btnSearch)
'
'Pagination
Dim pagination As ABMPagination
pagination.Initialize(page, "pagination", 5, True, True, "")
pagination.SetTotalNumberOfPages(0)
page.Cell(2,1).AddComponent(pagination)
' create a ABMtable to show records
Dim tblarc As ABMTable
tblarc.Initialize(page, "tblarc", False, False, True, "tbltheme")
tblarc.SetHeaders(Array As String("ID", "CODICE", "CLIENTE", "NOTE", "Carica/Edit", "Cancella"))
tblarc.SetHeaderThemes(Array As String("bgc", "bgc", "bgc", "bgc", "bgc", "bgc"))
tblarc.SetColumnVisible(Array As Boolean(False, True, True, True, True, True))
tblarc.IsResponsive = True
tblarc.IsBordered = True
tblarc.SetFooter("Numeri record: 0", 12, "bg")
' NOTE: We are using the CellR method (relative to current row)...
page.Cell(2,2).AddComponent(tblarc)
'load from DB
LoadClientiDB(1)
page.Refresh
End Sub
Sub LoadClientiDB(fromPage As Int)
' Get the ABMTable component...
Dim tblarc As ABMTable = page.Component("tblarc") ' get the table defined in SetTableClienti...
Dim sql As SQL = DBM.GetSQL
Dim numclienti As Int = DBM.SQLSelectSingleResult(sql, "SELECT Count(ID) as IDS FROM CLIENTI")
Dim clienti As List = DBM.SQLSelect(sql, "SELECT * FROM CLIENTI LIMIT " & ((fromPage - 1) * iRecs) & ", " & iRecs, Null)
If clienti.Size = 0 And fromPage > 1 Then
DBM.CloseSQL(sql)
fromPage = fromPage - 1
LoadClientiDB(fromPage)
Return
End If
If clienti.Size = 0 Then
Dim searchUser As ABMInput = page.Component("searchUser")
searchUser.Text = ""
searchUser.Refresh
page.ShowToast("srch1",""," Nessun Record trovato! Ricerca di nuovo...",2000,False)
End If
tblarc.SetFooter("Numeri record: " & numclienti, 12,"bgc")
' clear any old stuff in the table so we may add new...
tblarc.Clear
'add
For i = 0 To clienti.Size - 1
Dim tblfields As Map = clienti.Get(i)
Dim rCellValues As List
Dim rCellThemes As List
rCellValues.Initialize
rCellThemes.Initialize
For v = 0 To tblfields.Size - 1
rCellValues.Add(tblfields.GetValueAt(v))
rCellThemes.Add("nocolor")
Next
'button edit
Dim btnEdit As ABMButton
btnEdit.InitializeFloating(page, "btnEdit", "mdi-action-visibility", "")
rCellValues.Add(btnEdit)
rCellThemes.Add("openedit")
'button cancella
Dim btnDelete As ABMButton
btnDelete.InitializeFloating(page, "btnDelete", "mdi-action-delete", "btnred")
btnDelete.Size = ABM.BUTTONSIZE_SMALL
rCellValues.Add( btnDelete)
rCellThemes.Add( "openedit")
tblarc.AddRow("uid_" & i, rCellValues) '<<<<<<<<< Error
tblarc.SetRowThemes(rCellThemes) '<<<<<<<<< Error
Next
tblarc.Refresh
DBM.CloseSQL(sql)
'pagination
Dim pagination As ABMPagination = page.Component("pagination")
If (numclienti Mod iRecs > 0) Or (numclienti = 0) Then
numclienti = numclienti/iRecs + 1
Else
numclienti = numclienti/iRecs
End If
pagination.SetTotalNumberOfPages(numclienti)
pagination.SetActivePage(fromPage)
pagination.Refresh
End Sub
here appears the error:
B4X:
tblarc.AddRow("uid_" & i, rCellValues) '<<<<<<<<< Error
tblarc.SetRowThemes(rCellThemes) '<<<<<<<<< Error
This the error:
at com.ab.abmaterial.ABMTable.AddRow(Unknown Source)
If i comment this lines the Table is displayed.
Thanks for your help.