h:selectBooleanCheckbox does not work on rich:dataTable with rich:dataScroller
chuckie474 Apr 6, 2010 5:54 PMHi -
I have gone through and searched on this topic and haven't found a solution that works for me, so hopefully someone will be able to help me out. I have an editable dataTable that is reused in several places within my application, and each row contains columns with h:selectBooleanCheckbox, h:outputText, and h:selectOneMenu elements. When this table is included in a single jsp, scrolling from page 1 -> page 2 -> page 1 retains all of my changes correctly. However, when this table is included in a jsp which is included in another jsp, scrolling from page 1 -> page 2 -> page 1 loses all of my changes on page 1. Page 2 retains the changes. So here are snippets of my code:
employeeTable.jsp:
<rich:dataTable value="#{employeeList}" var="employee" rows="20">
<rich:column>
<h:selectBooleanCheckbox value="#{companyBean.selectedIds[employee.id]}"/>
</rich:column>
<rich:column>
<h:outputText value="#{employee.lastName}"/>
</rich:column>
<rich:column>
<h:outputText value="#{employee.firsttName}"/>
</rich:column>
<rich:column>
<h:outputText value="#{employee.middleName}"/>
</rich:column>
<rich:column>
<h:selectOneMenu value="#{employee.status}">
<f:selectItem itemLabel="Single" itemValue="0"/>
<f:selectItem itemLabel="Married" itemValue="1"/>
<f:selectItem itemLabel="Divorced" itemValue="2"/>
<f:selectItem itemLabel="Widowed" itemValue="3"/>
</rich:column>
<f:facet name="footer">
<rich:dataScroller id="sc" ajaxSingle="false" renderIfSinglePage="false" />
</f:facet>
</rich:dataTable>
In this form, there is only one include, so when changes are made to the rows and the user scrolls to subsequent pages, the changes are retained.
company.jsp:
<c:set var="employeeList" value="#{companyBean.employees}"/>
<@include file="/employees/employeeTable.jsp" %>
In this form, the company.jsp is included which includes the table.jsp and this is where it breaks. Changes made to page 1 - and ONLY page 1- are lost. If changes are made on pages 2 or 3 or 4, etc, they are retained. However, when the user goes back to page 1, the changes are lost.
organization.jsp:
<a4j:repeat var="companyBean" value="#{orgBean.companyList}">
<%@include file="/company.jsp" %>
</a4j:repeat>
Hope this makes sense to someone. Any help would be greatly appreciated.