I have a datatable in primefaces having filtering capability, Every row is also having checkboxes. When I filter the values, and change checkbox value, then press save button, the changed value does not appear in the backend when I print them. My datatable looks like:
<p:dataTable id="tbValues" widgetVar="kVar" var="k" value="#{mybean.values}" paginatorPosition="top" paginatorTemplate="{PreviousPageLink} {CurrentPageReport}
{NextPageLink}" filteredValue="#{mybean.filteredValues}" scrollable="true" >
<p:column headerText="Name" filterBy="#{k.name}" >
<h:outputText value="#{k.name}"/>
</p:column>
<p:column >
<f:facet name="header">
<h:outputText value="Value1"/>
</f:facet>
<h:selectBooleanCheckbox id="v1" value="#{k.value1}" immediate="true"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Value2"/>
</f:facet>
<h:selectBooleanCheckbox id="v2" value="#{k.value2}" immediate="true" />
</p:column>
<f:facet name="footer">
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton id="saveBt" value="Save" update="tbValues" widgetVar="saveBt" actionListener="#{mybean.saveValues}"/>
</p:toolbarGroup>
</p:toolbar>
</f:facet>
</p:dataTable>
and my bean method is:
public void saveValues(ActionEvent event){
System.out.println("filter: "+this.filteredValues);
if(this.filteredValues!=null) {
for(int i=0;i<this.filteredValues.size();i++) {
System.out.println(this.filteredValues.get(i).isValue1()+" "+this.filteredValues.get(i).isValue2());
}
}
}
My Primefaces version: 10
JSF: 2.2.15
Wildfly: 23
JDk: 16