Hi to all
the tests continue
In my app at first I create the navbar with a single component, basically an icon with the name of the working database
after reading the database tables
I try to add the list ot the tables to the NavBar
(first example with a combobox)
(second example with a list)
but nothing changes, the NavBAr always remains unchanged ?
Do I have to redesign it all or is the code wrong?
Thanks
the tests continue
In my app at first I create the navbar with a single component, basically an icon with the name of the working database
B4X:
Sub BuildNavDrawer
'*copy code after this line
vm.Drawer.Setwidth("300")
vm.Drawer.Setvisible(True)
'this page should show on the drawer
Dim bo As BANanoObject = BANano.GetLocalStorage("settaggi")
Dim jsonpars As BANanoJSONParser
jsonpars.Initialize(BANano.ToString(bo))
Dim m As Map = jsonpars.NextObject
db = m.Get("dbname")
vm.Drawer.AddIcon1($"page${db}"$, "mdi-database", "", db, "Database")
End Sub
B4X:
Sub LoadTables
Dim dbsql As BANanoMySQLE
dbsql.Initialize(db, "", "", "")
dbsql.SetConnection(dbhost, user, pass)
dbsql.GetTableNames
dbsql.json = BANano.CallInlinePHPWait(dbsql.MethodName, dbsql.Build)
dbsql.FromJSON
If dbsql.OK = False Then
vm.showsnackbarerror($"Errore lettura tabelle!"${CRLF}${dbsql.error}"$)
Return
Else
vm.ShowSnackBarSuccess("Tabelle lette correttamente!")
End If
Dim l As List
l.Initialize
If dbsql.result.Size > 0 Then
For Each record As Map In dbsql.result
l.add(record.Get("table_name"))
Next
AddTableNav(l)
Log("mostra Table")
End If
End Sub
(first example with a combobox)
B4X:
Sub AddTableNav(l As List)
' Log(l)
vm.Drawer.AddDivider
Dim cbo As VMSelect = vm.CreateComboBox("cbo", Me)
cbo.SetLabel("Seleziona archivio").SetOutlined(True)
cbo.AddItems(l)
vm.Drawer.AddChild(cbo1.Combo)
vm.Drawer.Refresh
End Sub
B4X:
Sub AddTableNav(l As List)
vm.Drawer.AddDivider
vm.Drawer.AddParentChild("","ai", "mdi-table", "", "Seleziona Archivio","")
For i = 0 To l.Size - 1
vm.Drawer.AddParentChild("ai","", "", "", l.Get(i),"")
'Log(l.Get(i))
Next
vm.Drawer.Refresh
End Sub
Do I have to redesign it all or is the code wrong?
Thanks