7 Replies Latest reply on Sep 11, 2007 4:41 AM by Amin Abu-Taleb

    input numer of pages in datascroller

    Mike K Newbie

      FYI

      I managed the following using the latest richfaces 3.0.2_SNAPSHOT:

      datascoller looking like << < x of 33 > >> instead of all the pager Links

      code snipplet:

      <rich:datascroller for="dataTable" id="scroller" binding="#{user.scroller}" boundaryControls="show" fastControls="show" stepControls="show">
      <f:attribute name="pageIndexVar" value="pageIndexVar" />
      <f:attribute name="pagesVar" value="pagesVar" />
      <f:facet name="pages" id="pages">
      <h:panelGroup>
      <h:inputText id="pager" value="#{user.pageIndex}" size="2" >
      <a4j:support event="onkeyup" reRender="dataTable,scroller" requestDelay="100" immediate="true"/>
      </h:inputText>
      <h:outputText id="maxPages" value="/ #{pagesVar}" />
      </h:panelGroup>
      </f:facet>
      </rich:datascroller>

      hope this helps anyone ;)

        • 1. Re: input numer of pages in datascroller
          paata lominadze Master

          if you post your baking bean it will be great.

          Thank you,

          • 2. Re: input numer of pages in datascroller
            paata lominadze Master

            if you post your backing bean it will be great.

            Thank you,

            • 3. Re: input numer of pages in datascroller
              Mike K Newbie

              and this would be the parts of the backingbean:

              ......
              private UIDatascroller scroller;

              public int getPageIndex() {
              return this.scroller.getPageIndex();
              }

              public void setPageIndex(int index) {
              int pageCount = this.scroller.getPageCount();
              if (index > pageCount) {
              index = pageCount;
              } else if (index <= 0) {
              index = 1;
              }
              this.scroller.setPage(index+"");
              }

              public UIDatascroller getScroller() {
              return this.scroller;
              }

              public void setScroller(UIDatascroller scroller) {
              this.scroller = scroller;
              }
              ......etc.

              • 4. Re: input numer of pages in datascroller
                kewldude Newbie

                what happened to this thread? any resolution?

                • 5. Re: input numer of pages in datascroller
                  Igor Shabalov Apprentice

                  What resolution do you expect?

                  • 6. Re: input numer of pages in datascroller
                    paata lominadze Master

                    hi suckerd,
                    i use richfaces 3.1.0 on my jboss seam project, i have done everything what you say but i got an exception :

                    Caused by: javax.el.ELException: /jguru/issue/content/admin/usrgrroles/projroleprowser.xhtml @111,183 binding="#{roleBean1.scroller}": java.lang.IllegalArgumentException: argument type mismatch
                     at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:101)
                     at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:213)
                     ... 85 more
                    Caused by: java.lang.IllegalArgumentException: argument type mismatch
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.refle
                    10:39:50,388 ERROR [STDERR] ct.Method.invoke(Method.java:585)
                     at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
                     at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
                     at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
                     at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
                     at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
                     at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
                     at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
                     ... 86 more
                    
                    

                    my example :
                    1. view
                    <scroller:datascroller for="permission" id="scroller" binding="#{roleBean1.scroller}" boundaryControls="show" fastControls="show" stepControls="show">
                     <f:attribute name="pageIndexVar" value="pageIndexVar" />
                     <f:attribute name="pagesVar" value="pagesVar" />
                     <f:facet name="pages" id="pages">
                     <h:panelGroup>
                     <h:inputText id="pager" value="#{roleBean1.pageIndex}" size="2" >
                     <a4j:support event="onkeyup" reRender="permission,scroller" requestDelay="100" immediate="true"/>
                     </h:inputText>
                     <h:outputText id="maxPages" value="/#{pagesVar}" />
                     </h:panelGroup>
                     </f:facet>
                     </scroller:datascroller>
                    

                    2. java backing bean
                    @Name("roleBean1")
                    public class TmpBean {
                    
                     private UIDatascroller scroller;
                    
                     public UIDatascroller getScroller() {
                     return this.scroller;
                     }
                    
                     public void setScroller(UIDatascroller scroller) {
                     this.scroller = scroller;
                     }
                    
                     public int getPageIndex() {
                     return this.scroller.getPageIndex();
                     }
                    
                     public void setPageIndex(int index) {
                     int pageCount = this.scroller.getPageCount();
                     if (index > pageCount) {
                     index = pageCount;
                     } else if (index <= 0) {
                     index = 1;
                     }
                     }
                    }
                    

                    did i something incorrect ? do you have this in seam project ??

                    Thanks In Advance.

                    • 7. Re: input numer of pages in datascroller
                      Amin Abu-Taleb Newbie

                      It works fine xD.

                      I used that:

                      <rich:datascroller id="scroller" for="DataTable" maxPages="1" boundaryControls="show" fastControls="hidden" stepControls="show">
                      <f:attribute name="pageIndexVar" value="pageIndexVar" />
                      <f:attribute name="pagesVar" value="pagesVar" />
                      <f:facet name="previous">
                      <h:panelGroup>
                      <h:outputText value="Prev"/>
                      </h:panelGroup>
                      </f:facet>
                      <f:facet name="next">
                      <h:panelGroup>
                      <h:outputText value="Next"/>
                      </h:panelGroup>
                      </f:facet>
                      <f:facet name="pages">
                      <h:panelGroup>
                      <h:outputText id="pager" value="#{pageIndexVar}">
                      <a4j:support event="onkeyup" reRender="dataTable,scroller" requestDelay="100" immediate="true"/>
                      </h:outputText>
                      <h:outputText id="maxPages" value="/ #{pagesVar}" />
                      </h:panelGroup>
                      </f:facet>
                      </rich:datascroller>


                      Thnx alot suckerd