I have a dynamically-created HtmlPanelGrid which is working fine. I want to use the same data but group them this time, and it won't work. Current hierarchy is:
Parent(HtmlPanelGrid)
|-->Child-1(HtmlPanelGrid)
|-->Child-1-1(Label/CommandButton)
|-->Child-1-2(Label/CommandButton)
|-->Child-2(HtmlPanelGrid)
|-->Child-2-1(Label/CommandButton)
|-->Child-2-2(Label/CommandButton)
Normally, I was showing it like this:
<h:panelGrid binding="#{configurationManagedBean.dynamicAddonGrid}"/>
where dynamicAddonGrid represents the parent element. But, I want to display a new panelGrid for every first-level child element. So I changed it like this:
<ui:repeat var="group" value="#{configurationManagedBean.dynamicAddonGrid.children}">
<h:panelGrid binding="#{group}" />
</ui:repeat>
But it shows nothing. This is how I create this hierarchy in the backing bean:
HtmlPanelGrid dynamicAddonGrid = new HtmlPanelGrid();
for(int gridIndex = 0; gridIndex < addonGrids.size(); gridIndex++){
AddonGrid currentGrid = addonGrids.get(gridIndex);
HtmlPanelGrid addonComponentPanelGrid = new HtmlPanelGrid();
addonComponentPanelGrid.setTitle(currentGrid.getDefinition());
addonComponentPanelGrid.setColumns(8);
for(int addonIndex = 0; addonIndex < currentGrid.getAddonList().size() ;addonIndex++){
Addon currentAddon = currentGrid.getAddonList().get(addonIndex);
HtmlOutputLabel labelComponent = new HtmlOutputLabel();
addonComponentPanelGrid.getChildren().add(labelComponent);
HtmlCommandButton commandButton = new HtmlCommandButton();
addonComponentPanelGrid.getChildren().add(commandButton);
}
dynamicAddonGrid.getChildren().add(addonComponentPanelGrid);
}
I omitted unrelated business logic for clarification.
Both parent and first-level child elements are HtmlPanelGrids, but somehow, I can't group them. I mean I can, but it just shows nothing. It seems like I'm overlooking something. Any help would be appreciated.