<h:form>
<fieldset>
<h:selectManyListbox id="listbox" value="#{form.items}">
<f:selectItems value="#{form.allItems}">
</h:selectManyListbox>
</fieldset>
<h:commandButton value="Get Table" action="#{form.getTable}">
<f:ajax render="result_table" execute="listbox" />
</h:commandButton>
<h:panelGrid id="result_table">
<table>
<thead></thead>
<tbody>
<ui:repeat var="table" value="#{form.resultTable}">
<tr>
<td>#{table.name}</td>
<td>
<h:selectBooleanCheckbox binding="#{showMore}">
<f:ajax render="inner" />
</h:selectBooleanCheckbox>
</td>
</tr>
<tr>
<td>
<h:panelGrid id="inner" rendered="#{not empty showMore.value and showMore.value}">
<table></table>
</h:panelGrid>
</td>
</tr>
</ui:repeat>
</tbody>
</table>
</h:panelGrid>
</h:form>
I followed the checkbox sample code from BalusC here.
When I click the command button, based on the list box values, it generates a table result which I display in h:panelGrid id="result_table"
. This command button works. Inside the generated table, I have some sub-tables I want to display, but only if I check the box to show them. For the checkbox if I use render="@form"
it collapses my outer parent table. If I use render="inner"
checking/unchecking box does nothing.
How do I get this to work? Is it because the two ajax are in conflict?
FYI, I also tried using a bean property instead but got the same result. When I tried using the javascript method mentioned in the same link, but checking/unchecking the box has no effect.
Updated to add example snippet and <ui:repeat></ui:repeat>
above:
<h:selectBooleanCheckbox binding="#{showMore}">
<f:ajax render="inner" />
</h:selectBooleanCheckbox>
<h:panelGrid id="inner">
<h:outputText value="always" />
<h:outputText value="hidden" rendered="#{not empty showMore.value and showMore.value}" />
</h:panelGrid>