2 Replies Latest reply on Sep 7, 2009 6:58 PM by Nick Belaevski

    filterBy on dataTable not updating dataScroller

    Jason Hopkins Newbie

      I'm using a datatable with filterBy and a datascroller. All is fine, apart from if the datascroller shows 5 pages and I enter something into the filter so there are now only have 5 rows, the datascroller still says 5 pages.

      When this happens the "Add Tutor" button in the header and the records per page drop down stops responding to user input. I found that anything that causes the datascroller to re-render fixes the problem.

      I've tried many, many things to fix this and found that if I wrap the whole table in a <a4j:outputPanel ajaxRendered="true"> everything works fine, but the filter input boxes loose focus after filtering. Code below, if anyone can see what I've done wrong I'll be very greatful, this has been driving me crazy!

       <a4j:form id="tutorForm">
       <rich:dataTable id="tutorTable" width="100%"
       value="#{AdminTutorBean.tutorModel}" var="tutor"
       rows="#{AdminTutorBean.recordsPerPage}" columnsWidth="25%,25%,40%,20%">
       <f:facet name="header">
       <h:panelGrid columns="2" width="100%"
       columnClasses="leftAlign, rightAlign">
       <h:outputText value="Tutors" />
       <h:outputText value="Tutors per page: " />
       <h:selectOneMenu value="#{AdminTutorBean.recordsPerPage}">
       <f:selectItem itemLabel="5" itemValue="5" />
       <f:selectItem itemLabel="10" itemValue="10" />
       <f:selectItem itemLabel="15" itemValue="15" />
       <f:selectItem itemLabel="20" itemValue="20" />
       <f:selectItem itemLabel="30" itemValue="30" />
       <f:selectItem itemLabel="40" itemValue="40" />
       <f:selectItem itemLabel="50" itemValue="50" />
       <a4j:support event="onchange" reRender="tutorTable" />
       <rich:column sortBy="#{tutor.firstName}"
       filterBy="#{tutor.firstName}" filterEvent="onkeyup">
       <f:facet name="header">
       <h:outputText value="First Name" />
       <h:outputText value="#{tutor.firstName}" />
       <rich:column sortBy="#{tutor.surname}" filterBy="#{tutor.surname}"
       <f:facet name="header">
       <h:outputText value="Surname" />
       <h:outputText value="#{tutor.surname}" />
       <f:facet name="header">
       <h:outputText value="Description" />
       <h:outputText value="#{tutor.shortDescription}" />
       <f:facet name="header">
       <a4j:commandButton value="Add Tutor"
       reRender="tutorForm,addEditForm" />
       <a4j:commandButton value="Edit" reRender="addEditForm"
       action="#{AdminTutorBean.setUpForEdit}" />
       <a4j:commandButton value="Delete"
       reRender="tutorForm,confirmDeleteForm" />
       <f:facet name="footer">
       <rich:datascroller id="tutorTablePager" maxPages="15" />