5 Replies Latest reply on Jan 11, 2008 10:43 AM by John McClain

    how to - programmatic control of datascroller

    John McClain Newbie

      I wish to be able to programmatically control the rich:datascroller and can find no examples of how to do that; I want to move to the first row on certain conditions - as if I was hitting the [<< <<] button. How do I do that?

        • 2. Re: how to - programmatic control of datascroller
          Daniel Soneira Novice

          First, bind the control to a backing bean attribute in your jsp.

          <rich:datascroller binding="${BackingBean.datascroller}"/>



          After that u can use something like that (see function resetDatascroller):

          public class BackingBean {
           private UIDatascroller datascroller;
          
           public UIDatascroller getDatascroller() {
           return datascroller;
           }
          
           public void setDatascroller(UIDatascroller datascroller) {
           this.datascroller = datascroller;
           }
          
           private void resetDatascroller() {
           datascroller.setPage(UIDatascroller.FIRST_FACET_NAME);
           }
          }


          This code snippet shows how to go to the first page of the responding scrollers datatable.

          • 3. Re: how to - programmatic control of datascroller
            John McClain Newbie

            Thank you for the response - the problem I have had when trying to bind ANY richfaces component to a backing bean is

            .
            .
            . at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
             at java.lang.Thread.run(Unknown Source)
            Caused by: javax.el.ELException: /caseDetail.xhtml @510,47 binding="${caseManagement.datascroller}": 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:237)
             ... 65 more
            Caused by: java.lang.IllegalArgumentException: argument type mismatch
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             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)
             ... 66 more


            Any ideas why that would happen?

            • 4. Re: how to - programmatic control of datascroller
              Daniel Soneira Novice

              Let us see your code regarding that datascroller in the backing bean.

              Did you use org.richfaces.component.UIDatascroller as type?

              I've used the code I described in my previous post EXACLTY as it is just some days ago and it works :]

              You could of course just break on this IllegalArgumentException and look in the debugger what he is trying to pass as argument ;)

              • 5. Re: how to - programmatic control of datascroller
                John McClain Newbie

                Thank you for your response! I have actually posted this in a little more detail in another entry. Here is the link http://www.jboss.com/index.html?module=bb&op=viewtopic&t=127411

                If you have any ideas about why, I would love to hear them. What I can tell you is that I put a breapoint in the getter and setter. I am running a seam application, and when the XHTML page is parsed, it runs the getters for the EL expressions needed to render the page. When it gets to the getter for the datascroller is when I get the above error