Hello,
I'm using erel's example code posted in the ExpandableTableView thread. Everything works fine, but i can't seem to understand how to regenerate the view after deleting all the childrens.
I split the initialization and population code, adding a couple test buttons. After calling "delete" or "refresh", and then "Init" ,the ExpandableTableView does not regenerate, showing just a blank screen.
The view is already there and initialized, so i figured repopulating it was enough
What is the correct way to do this?
I'm using erel's example code posted in the ExpandableTableView thread. Everything works fine, but i can't seem to understand how to regenerate the view after deleting all the childrens.
B4X:
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("1")
NavControl.ShowPage(Page1)
NavControl.ToolBarVisible = True
etv.Initialize(Me, "etv")
Page1.RootPanel.AddView(etv.View, 0, 0, 100%x, 100%y)
initETV 'In the original example this subs's content followed here
End Sub
Sub initETV
For i1 = 1 To 10
Dim c As CustomCell
c.Initialize
c.Text = "Item #" & i1
c.Children.Initialize
If i1 Mod 2 = 0 Then
CreateCustomItem(c)
For i2 = 1 To 5
Dim c2 As CustomCell
c2.Initialize
c2.Text = "Child #" & i2
c.Children.Add(c2)
c2.Children.Initialize
If i2 Mod 2 = 0 Then
CreateCustomItem(c2)
For i3 = 1 To 3
Dim c3 As CustomCell
c3.Initialize
c3.Text = "Grandchild #" & i3
CreateCustomItem(c3)
c2.Children.Add(c3)
Next
End If
Next
End If
etv.Root.Children.Add(c)
Next
etv.RefreshItems
End Sub
Sub Page1_BarButtonClick (Tag As String)
Select Tag
Case "ExpandAll"
etv.ExpandAll
Case "CollapseAll"
etv.collapseAll
'i added these last 3 for debug purposes, and implemented them in the layout file
Case "Init"
initETV
Case "Delete"
etv.Root.Children.Clear
etv.ExpandAll
Case "Refresh"
etv.tv.Clear
End Select
End Sub
I split the initialization and population code, adding a couple test buttons. After calling "delete" or "refresh", and then "Init" ,the ExpandableTableView does not regenerate, showing just a blank screen.
The view is already there and initialized, so i figured repopulating it was enough
What is the correct way to do this?
Last edited: