1 Reply Latest reply on Oct 10, 2007 1:10 PM by mwkohout

    Can I use a inputNumberSlider to control a dataTable's row a

    mwkohout

      I've got a facelet that contains, among other things, a dataTable and an attached datascroller.
      That code behaves as it should.

      However I had the nifty idea of using a inputNumberSlider to alter the the # of elements appear on each page of the dataTable.

       <rich:panel id="currentSubjectPanel">
       <f:facet name="header">Current Subjects</f:facet>
       <rich:datascroller id="currentSubjectDatascroller" renderIfSinglePage="false" for="currentSubjects" >
       <f:facet name="pages">
       <h:outputText value="#{pageIndex} / #{pages}"></h:outputText>
       </f:facet>
       </rich:datascroller>
       <rich:dataTable id="currentSubjects" value="#{study.currentStudySubjects}" var="studySubject"
       rows="#{viewStudyAction.currentStudySubjectViewSize}">
       <rich:column><f:facet name="header">Name</f:facet>
       #{studySubject.subject.firstName} #{studySubject.subject.lastName}
       </rich:column>
       <!-- there are a few more columns here but it's
       not important to this question so they are omitted -->
       </rich:dataTable>
       <rich:inputNumberSlider value="#{viewStudyAction.currentStudySubjectViewSize}" minValue="1"
       maxValue="#{viewStudyAction.maxCurrentStudySubjectViewSize}" showInput="false" >
       <a4j:support event="onchange" requestDelay="500" reRender="currentSubjectPanel"
       ignoreDupResponces="true" eventsQueue="myQueue"/>
       </rich:inputNumberSlider>
       </rich:panel>
      


      As you can see, the jsf components are tied to several fields on the action(which is conversation scoped):

      viewStudyAction.maxCurrentStudySubjectViewSize for the most part is the # of elements in the list of objects being
      iterated (the only case where this isn't true is where the list.size == 0. in that case, maxCurrentStudySubjectViewSize = 1).

      viewStudyAction.currentStudySubjectViewSize is what is changed by the slider.


      The behavior exhibited is that the numberSlider's value "seeks" after it's moved. So the page will render, you move the slider, then it constantly refreshes, never remaining at the same(correct) value.

      I'm at Seam 2 RC 2 and Richfaces 3.1.1 GA on JBoss 4.2.1

      Any ideas?

      thanks
      Mike Kohout