8 Replies Latest reply on Jul 4, 2007 7:06 AM by ilya_shaikovsky

    reRender problem with datascroller

      Hi,

      I have a problem getting my datascroller work properly.

      I have a form with some fields on the top. After the fields are filled the dataTable update ( and filled ), also the dataScroller is part of the reRender-attribute.
      I have a button with which contains the reRender attribute and which is responsible for the updating.
      Here some code snippets:

      
      <h:form >
      ...
       <h:inputText id="filiale" value="#{sessionBackingBean.currentFiliale}" required="true" maxlength="4" size="4"/>
       ...
       <a4j:commandButton id="showItems" value="#{msg.show_items}" action="#{sessionBackingBean.showMseItems}" reRender="mseItems,dsMseItems"/>
      
       <rich:datascroller id="dsMseItems" for="mseItems" maxPages="20" />
      
       <rich:dataTable rows="10" id="mseItems" value="#{sessionBackingBean.mseItems}" var="item">
       ...
       </rich:dataTable>
      </h:form>
      

      The strange thing is that after clicking the command button the dataTable is filled correctly, but the datascroller still shows the old state.
      When I click the button again also the datascroller is shown correctly.

      Does anybody has an idea why this happens and what I can do...?

      Thanks in advance...

        • 1. Re: reRender problem with datascroller

          probably, it is because of the form validation failed due the inputText validators. Does it make difference if you inputText is not empty?

          • 2. Re: reRender problem with datascroller

            Hi,
            I found a (unsatisfactory) solution:
            When I place the datascroller after the dataTable

            <rich:datascroller id="dsMseItems" for="mseItems" maxPages="20" />
            <rich:dataTable rows="10" id="mseItems" value="#{sessionBackingBean.mseItems}" var="item">
            ...
            </rich:dataTable>
            

            it works as expected. Is it possible that the datascroller gets data from the rendered dataTable?
            Does anybody know if there's a way to place the dataScroller before the dataTable...?

            • 3. Re: reRender problem with datascroller

              Of course I mean

              <rich:dataTable rows="10" id="mseItems" value="#{sessionBackingBean.mseItems}" var="item">
              ...
              </rich:dataTable>
              <rich:datascroller id="dsMseItems" for="mseItems" maxPages="20" />
              

              ;)

              • 4. Re: reRender problem with datascroller

                Oh, OK. It looks like you use JSF 1.1 . If so, it is very famous problem of it.

                • 5. Re: reRender problem with datascroller

                  Hi,

                  You're right, I'm using MyFaces 1.5 (which implementes the jsj1.1 specification).
                  Do you know a way to solve the problem with this implementation?

                  • 6. Re: reRender problem with datascroller
                    ilya_shaikovsky

                    I've wrapped your

                    <rich:datascroller id="dsMseItems" for="mseItems" maxPages="20" />
                    <rich:dataTable rows="10" id="mseItems" value="#{sessionBackingBean.mseItems}" var="item">
                    ...
                    </rich:dataTable>

                    with a4j:outputPanel component and it starts works as expected.

                    • 7. Re: reRender problem with datascroller

                      Hi ilya_shaikovsky,

                      that doesn't work for me, do you also work with myfaces 1.5 (and with the 1.1. jsf implementation)?

                      • 8. Re: reRender problem with datascroller
                        ilya_shaikovsky

                        So my test code:

                        <h:form id="form">
                         <h:inputText value="#{capitalsBean.rows}" required="true"
                         maxlength="4" size="4" id="textfield">
                         </h:inputText>
                         <a4j:commandButton id="showItems" value="add/remove rows"
                         reRender="table, scroller" />
                         <a4j:outputPanel>
                         <rich:datascroller id="scroller" for="table" maxPages="20" />
                         <rich:dataTable rows="#{capitalsBean.rows}" id="table"
                         value="#{capitalsBean.capitals}" var="cap">
                         <rich:column>
                         <h:outputText value="#{cap.name}"></h:outputText>
                         </rich:column>
                         <rich:column>
                         <h:outputText value="#{cap.state}"></h:outputText>
                         </rich:column>
                         </rich:dataTable>
                         </a4j:outputPanel>
                         </h:form>


                        So In my code I'm changing the number of rows. And the scrioller updates successfully for me.

                        My Environment:
                        MyFaces Implementation-Version: 1.1.5
                        No facelets. (My be you've uses?)
                        Tomcat 5.5.17
                        Rich Faces and ajax4jsf 3.0.2 and 1.1.2 SNAPSHOTS.