B4J Question [ABMaterial] Collapsable Container usage.... my many issues...


Licensed User
Hi Guys,

So... back again at it!!!

"cont2" is a collapsable container created in the "ConnectPage" sub, using this code;
    Dim cont3 As ABMContainer
    cont3.InitializeCollapsable(page, "cont3", "", "", "", False)
    cont3.CollapsableHeading.BuildGrid ' IMPORTANT!
'    cont3.CollapsableHeading.OpenContent
'    cont3.CollapsableBody.OpenContent
    cont3.CollapsableHeading.Row(1).Margintop = "75px"
    cont3.CollapsableHeading.Row(1).marginBottom = "0"
As you can see it is already inside another container, but this is besides the point.

Inside "cont3", each cell holds a button.
My objective is/was to create a different "CollapsibleBody" grid, depending on which button was clicked...

Sub btn1_Clicked(Target As String)
    Dim FloatingCont1 As ABMContainer = page.FloatingContainer("floatingcont1")
    Dim Cont2 As ABMContainer = FloatingCont1.Component("cont2")
    Dim collbody As ABMContainer = Cont2.Component("cont3")
    collbody.CollapsableBody.BuildGrid ' IMPORTANT!
'    collbody.CollapsableHeading.OpenContent
    Dim btn1 As ABMButton
    btn1.InitializeFlat(page, "btn1", "", "", "{B}Activitées{/B}", "topbar")
    btn1.UseFullCellWidth = True
End Sub
This is giving me 3 different issues:
1st - First button click does not expand the collapsable body. Second button click does, whiwh then brings me to my second issue:
2nd - Each time the collapsableBody expands, a new row is added... which seems logic... maybe?
3rd - I try to eliminate the 2nd issue by placing a "clearGrid" just before I create it again, but it doesnt work and the Dody ends up empty...

SO.... for the first one... I guess I'm missing an itinial state, but I can't see how to set it...
and for the second and third.... should I just go with a different solution, using one collapsable container for each button?


Licensed User
I'm not at my PC right now so I'm trying to do this from my phone. I would do this. At the end of the btn1_click try to add collbody.refresh (at that point in your code, all is 'defined' on the server side, nothing pushed to the browser yet). Do the collaspableBody.Addrows (1 row, 1 cell) when you create the cont3. I would then create three containers, one for each button. In btn1_clicked, collbody.collapseablebody.row(1).removeallcomponents (can't recall the correct method name out of my head) to remove the previous 'button' container (if any) and add the new 'button' container to the cell(1,1). Then do a refresh. I can try more tomorrow morning.
Upvote 0


Licensed User
At the end of the btn1_click try to add collbody.refresh (at that point in your code, all is 'defined' on the server side, nothing pushed to the browser yet).
This seems to have taken care of the "ClearGrid... BuilGrid" portion....
Now I just need to figure out how to expand on the first button click
Last edited:
Upvote 0