Checkbox inside ui: repeat not updated by Ajax

I am working with Mojarra 2.1.3.

When the user clicks the “Update does not work” button, he updates the contents of the ui: repeat.I file, I expect the checkbox to be checked, just like during initialization.

What I found: if I remove h: the head in the face “update does not work” works ... Any idea?

Front side:

<h:head></h:head> <h:body> <h:form id="myForm" > <h:panelGroup id="panelToRefreshOutsideRepeat"> <ui:repeat value="#{sandbox.columns}" var="column"> <h:panelGroup id="panelToRefreshInsideRepeat"> <h2>composite onlyCheckbox:</h2> <trc:onlyCheckbox value="#{column.value}" /> <br /> <h2>composite onlyInputText:</h2> <trc:onlyInputText value="#{column.value}" /> <br /> <br/> <h:commandButton value="Refresh don't work" > <f:ajax render="panelToRefreshInsideRepeat" /> </h:commandButton> <h:commandButton value="Refresh work" > <f:ajax render=":myForm:panelToRefreshOutsideRepeat" /> </h:commandButton> </h:panelGroup> <br/> </ui:repeat> </h:panelGroup> 

Composite for onlyCheckbox and onlyInputText:

 <composite:interface> <composite:attribute name="value" type="boolean"/> </composite:interface> <composite:implementation> boolean: <h:selectBooleanCheckbox value="#{cc.attrs.value}" /> <!-- for onlyInputText h:inputText instead of h:selectBooleanCheckbox --> boolean value: #{cc.attrs.value} </composite:implementation> 

and bean support:

 @ManagedBean @RequestScoped public class Sandbox { public List<Column> columns = Arrays.asList(new Column(true)); public List<Column> getColumns() { return columns; } public void setColumns(List<Column> columns) { this.columns = columns; } public class Column { private boolean value; public Column(boolean value) { this.value = value; } public void setValue(boolean value) { this.value = value; } public boolean getValue() { return this.value; } } } 
+2
source share
1 answer

I can reproduce your problem even on the latest version of Mojarra 2.1.4. It works fine if the checkbox is not inside the compound. This is a bug in Mojarra <ui:repeat> . It is completely in Mojarra. It works fine on MyFaces 2.1.3 .

You have 2 options:

  • Replace Mojarra with MyFaces.
  • Use UIData instead of <ui:repeat> , for example. <h:dataTable> , <t:dataList> , <p:dataList> etc.
+5
source

All Articles