B4J Question TreeView structure from Database

Emanuel Straub

Member
Licensed User
Longtime User
Hi guys,

i need help by creating a TreeView structure from MySQL Table.
My database table has 3 columns:

1. id
2. name
3. parent_id

1592991715660.png


Now on client side i load the data via httpjob and parse it into json.

B4X:
    Dim job As HttpJob
    job.Initialize("",Me)
    job.Username=Main.api_user
    job.Password = Main.api_pw
    job.Download($"${Main.server}/api/categories$)
    Wait For (job) jobDone(job As HttpJob)
    If job.Success Then
        Dim parser As JSONParser
        parser.Initialize(job.GetString)
        Dim root As List = parser.NextArray
        For Each colroot As Map In root
            Dim id As Int = colroot.Get("id")
            Dim name As String = colroot.Get("name")
            Dim parent_id As Int = colroot.Get("id")
            '??? here add the element in Treeview ???
        Next
    Else
        Log("No Server connection!")
    End If
    job.Release

Can anybody help me with this?
 

DonManfred

Expert
Licensed User
Longtime User
 
Upvote 0
Top