8 Replies Latest reply on Jun 13, 2007 2:52 PM by grimholtz

    dataScroller not updating

    grimholtz

      Hi,

      I searched the forums to see if this has been answered before. I found http://jboss.com/index.html?module=bb&op=viewtopic&t=104474 but it doesn't help. I have the following:

      < h:form ... >
       < t:dataTable id="table" ... />
       < t:dataScroller ... />
       < h:outputText value="Rows per page: "/>
       <h:inputText value="#{myBean.rowsPerPage}"/>
       <a4j:commandButton value="Update" reRender="table"/>
       <a4j:status>
       <f:facet name="start">
       <h:graphicImage value="/images/progress.gif"/>
       </f:facet>
       </a4j:status>
       <a4j:outputPanel ajaxRendered="true">
       <h:message for="rowsPerPage"/>
       </a4j:outputPanel>
      < /h:form>

      Here's a screenshot of the dataScroller, commandButton, and relevant text: http://img236.imageshack.us/img236/7265/capture6112007110828ambi3.png.

      When changing Rows Per Page, the dataTable updates successfully but the the dataScroller does not. Example: dataScroller dislpays "3128 rows found. Displaying rows 1 to 25. This is page 1 of 126." If I change Rows Per Page to 25, the table now displays 25 rows (correct) but the dataScroller doesn't change. I tried using aj4:form instead of h:form as described http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/devguide/developerGuide.html#form. But this has the same result... dataScrollers do not update.

      Any ideas what I could be doing wrong?

      Thank you,
      grimholtz

        • 1. Re: dataScroller not updating
          ilya_shaikovsky

          Hm.. Just used your code with the control like

          <rich:datascroller for="table" id="scroller" />
          
          <h:inputText value="#{capitalsBean.rows}"></h:inputText>
          <a4j:commandButton value="Change rows count" reRender="table, scroller"/>
          
          


          works as expected for me.

          • 2. Re: dataScroller not updating
            grimholtz

            Must I use rich:datascroller? I cannot use t:datascroller?

            • 3. Re: dataScroller not updating
              grimholtz

              The reason I ask is because we don't use RichFaces now, just ajax4jsf. I'm not sure I want to import another library into the project.

              • 4. Re: dataScroller not updating
                grimholtz

                I just tried rich:datascroller. It does not work for me because it doesn't support a lot of the attributes that t:datascroller does. Here are two of my datascrollers. You can see rich:datascroller doesn't support a lot of these attributes:

                < t:dataScroller id="ds2
                 for="table"
                 rowsCountVar="rowsCount"
                 displayedRowsCountVar="displayedRowsCountVar"
                 firstRowIndexVar="firstRowIndex"
                 lastRowIndexVar="lastRowIndex"
                 pageCountVar="pageCount"
                 immediate="true"
                 pageIndexVar="pageIndex">
                
                 < h:outputFormat value="{0} row found.">
                 < f:param value="#{rowsCount}" />
                 < f:param value="#{firstRowIndex}" />
                 < f:param value="#{lastRowIndex}" />
                 < f:param value="#{pageIndex}" />
                 < f:param value="#{pageCount}" />
                 < /h:outputFormat>
                 < h:outputFormat value="Displaying rows {1} to {2}.">
                 < f:param value="#{rowsCount}" />
                 < f:param value="#{firstRowIndex}" />
                 < f:param value="#{lastRowIndex}" />
                 < f:param value="#{pageIndex}" />
                 < f:param value="#{pageCount}" />
                 < /h:outputFormat>
                 < h:outputFormat value="This is page {3} of {4}">
                 < f:param value="#{rowsCount}" />
                 < f:param value="#{firstRowIndex}" />
                 < f:param value="#{lastRowIndex}" />
                 < f:param value="#{pageIndex}" />
                 < f:param value="#{pageCount}" />
                 < /h:outputFormat>
                < /t:dataScroller>
                
                < t:dataScroller id="ds1" for="table" fastStep="10" paginator="true"
                 paginatorMaxPages="9" paginatorTableClass="tClass" immediate="true"
                 rowsCountVar="rowsCount" pageCountVar="pageCount"pageIndexVar="pageIndex"
                 firstRowIndexVar="firstRowIndex" lastRowIndexVar="lastRowIndex"
                 paginatorActiveColumnClass="paginator-active-column">
                
                 < f:facet name="first">...< /f:facet>
                 < f:facet name="last">...</f:facet>
                 < f:facet name="previous">...< /f:facet>
                 < f:facet name="next">...< /f:facet>
                 < f:facet name="fastforward">...< /f:facet>
                 < f:facet name="fastrewind">...< /f:facet>
                < /t:dataScroller>


                Any other ideas?

                thank you,
                grimholtz

                • 5. Re: dataScroller not updating
                  wesleyhales

                  I just got a post to my blog about someone getting this to work... here

                  But, t:datascroller has always been a problem... I would recommend not wating time and go ahead and import Richfaces. I would take their components over the Tomahawk stuff any day.

                  • 6. Re: dataScroller not updating
                    grimholtz

                     

                    "wesleyhales" wrote:
                    I just got a post to my blog about someone getting this to work... <a href="http://www.jroller.com/page/wesleyhales/?anchor=ajax4jsf_vs_ajaxanywhere_the_t">here</a>

                    But, t:datascroller has always been a problem... I would recommend not wating time and go ahead and import Richfaces. I would take their components over the Tomahawk stuff any day.


                    Thanks! I'll give it a try. Quoted here:

                    You can actually get the datascroller to update as well, by putting it in a <t:div> container and having that element updated.
                    The code then becomes :
                    <a4j:form ajaxSubmit="true" reRender="carList,carIndex,scroll_1_div">
                    ...
                    <t:div id="scroll_1_div">
                    <t:dataScroller id="scroll_1"
                    ...

                    Works like a charm!


                    • 7. Re: dataScroller not updating
                      grimholtz

                      This works. If you don't use a4j:form, you can also use:

                      <h:form>
                      ...
                       <t:div id="div4a4j">
                       <t:dataScroller ... />
                       </t:div>
                      </h:form
                      


                      wesleyhales--thanks very much!

                      • 8. Re: dataScroller not updating
                        grimholtz

                         

                        "grimholtz" wrote:
                        This works. If you don't use a4j:form, you can also use:

                        <h:form>
                        ...
                         <t:div id="div4a4j">
                         <t:dataScroller ... />
                         </t:div>
                        </h:form
                        


                        wesleyhales--thanks very much!

                        I forgot to include the commandButton, of course:
                        <a4j:commandButton value="submit" reRender="myTable,divForAjax1"/>