9 Replies Latest reply on Nov 1, 2007 11:28 AM by Diego Coronel

    DataScroller Problem

    Diego Coronel Apprentice

      Hi, im with problems .. my problem:
      i have 1 page and i did a search, my scroller shows 4 pages (its correct), then i choose page 4 (its ok here), but, when i do another search that return 1 element, my table dont show any row and my scroller looks correct, so i click to go to first element and my table show my row, so, its look like mey scroller is saved in page 4, and my result goes to page 1, anyone know whats wrong ?

        • 1. Re: DataScroller Problem
          Adrian Mitev Master

          Please post the code with the dataTable and the scroller and your jsf version

          • 2. Re: DataScroller Problem
            Marcelo Krebber Newbie

            hi, i had the same problem. there is a simple workaround though:

            1) bind the scroller element to your backing bean and
            2) before updating the table set the scroller page to "1"

            smtgh. like:

            <rich:datascroller id="id_ds" for="id_table"
             binding="#{mybackingbean.datascroller}"
            


            and in the backing bean, for ex. in the action for a form:
            public String myActuon() {
            ..
            datascroller.setPage("1");
            datascroller.setPageIndexVar("1");
            ..
            return null;
            
            


            marcelo

            • 3. Re: DataScroller Problem
              Marcelo Krebber Newbie

              of course, datascroller needs to be defined as:

              private HtmlDatascroller datascroller;
              



              • 4. Re: DataScroller Problem
                Diego Coronel Apprentice

                ty marc, ill try this solution, but is there any issue for this problem ?

                • 5. Re: DataScroller Problem
                  Diego Coronel Apprentice

                  hey marc, i tried this solution but i got some problems

                  SEVERE: Error Rendering View[/faces/ator/AtorList.xhtml]
                  com.sun.facelets.tag.TagAttributeException: /faces/ator/AtorList.xhtml @109,44 for="atorList" object is not an instance of declaring class
                   at com.sun.facelets.tag.BeanPropertyTagRule$LiteralPropertyMetadata.applyMetadata(BeanPropertyTagRule.java:53)
                   at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36)
                   at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:62)
                   at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:144)
                   at com.sun.facelets.tag.jsf.core.FacetHandler.apply(FacetHandler.java:64)
                   at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                   at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                   at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                   at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                   at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                   at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                   at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                   at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
                   at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
                   at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:312)
                   at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:282)
                   at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
                   at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                   at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                   at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                   at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                   at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                   at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                   at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                   at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:144)
                   at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                   at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                   at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                   at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
                   at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:509)
                   at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:552)
                   at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                   at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                   at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                   at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
                   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 com.sun.facelets.tag.BeanPropertyTagRule$LiteralPropertyMetadata.applyMetadata(BeanPropertyTagRule.java:49)
                   ... 73 more
                  


                  this is my bean
                  package br.gov.exercito.silog.beans;
                  
                  import java.util.Arrays;
                  import java.util.List;
                  
                  import org.jboss.seam.annotations.Name;
                  import org.jboss.seam.framework.EntityQuery;
                  import org.richfaces.component.html.HtmlDatascroller;
                  
                  @Name("atorList")
                  public class AtorList extends EntityQuery {
                  
                   private static final String[] RESTRICTIONS = {"lower(ator.txNome) like lower('%'||#{atorList.ator.txNome}||'%')"};
                  
                   private Ator ator = new Ator();
                   private HtmlDatascroller datascroller = new HtmlDatascroller();
                  
                   @Override
                   public String getEjbql() {
                   return "select ator from Ator ator";
                   }
                  
                   @Override
                   public Integer getMaxResults() {
                   return null;
                   }
                  
                   public Ator getAtor() {
                   return ator;
                   }
                  
                   @Override
                   public List<String> getRestrictions() {
                   return Arrays.asList(RESTRICTIONS);
                   }
                  
                   public HtmlDatascroller getDatascroller() {
                   return datascroller;
                   }
                  
                   public void setDatascroller(HtmlDatascroller datascroller) {
                   this.datascroller = datascroller;
                   }
                  
                   @Override
                   public List getResultList() {
                   List list = super.getResultList();
                   System.out.println("#####Entrou 1######");
                   //datascroller.setPage("1");
                   System.out.println("#####Saiu 1######");
                   datascroller.setPageIndexVar("1");
                   System.out.println("#####Saiu 2######");
                   return list;
                   }
                  
                  }
                  
                  


                  and my xhtml
                  <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  
                  <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:s="http://jboss.com/products/seam/taglib"
                   xmlns:ui="http://java.sun.com/jsf/facelets"
                   xmlns:f="http://java.sun.com/jsf/core"
                   xmlns:h="http://java.sun.com/jsf/html"
                   xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                   template="/layout/template.xhtml"
                   xmlns:a="https://ajax4jsf.dev.java.net/ajax"
                   xmlns:fpf="http://www.fpf.com/silog/setup"
                   xmlns:c="http://java.sun.com/jstl/core">
                  
                  <ui:define name="body">
                   <a:form ajaxSubmit="true" reRender="atorList, atorListDataScroller">
                  
                   <s:decorate template="/layout/principal_pesquisa_titulo.xhtml">
                   <ui:define name="title">#{resourceAtor.atorLabelPequisa}</ui:define>
                   </s:decorate>
                  
                   <fpf:messages/>
                  
                   <rich:simpleTogglePanel label="#{msg.APP_TITLE_PARAMETRO_PESQUISA}"
                   switchType="client" opened="false">
                  
                   <s:decorate id="atorNomeDecoration" template="/layout/edit.xhtml">
                   <ui:define name="label">#{resourceAtor.atorLabelNome}</ui:define>
                   <h:inputText id="txNomeAtor" size="75" maxlength="50"
                   value="#{atorList.ator.txNome}">
                   </h:inputText>
                   </s:decorate>
                   <rich:spacer height="2" />
                   <h:panelGrid columns="3">
                   <a:commandButton styleClass="bt_pesquisar" id="btPesquisar"/>
                   <rich:spacer width="10" />
                   <a:status>
                   <f:facet name="start">
                   <h:graphicImage value="/img/progress.gif"/>
                   </f:facet>
                   </a:status>
                   </h:panelGrid>
                  
                   </rich:simpleTogglePanel>
                   <h:panelGrid columns="1">
                   <rich:spacer height="3" />
                   <h:outputText value="#{msg.APP_TITLE_RESULTADO_PESQUISA} - #{atorList.resultList.size()}"
                   styleClass="titulo2" id="tese"></h:outputText>
                   </h:panelGrid>
                  
                  
                   <rich:spacer height="10" />
                   <rich:dataTable width="500" height="600" id="atorList" rows="10"
                   columnClasses="columm-classe-arrow, col, col, columm-classe-delete"
                   rowClasses="row-classe-first, row-classe-sec"
                   value="#{atorList.resultList}" var="ator" first="0">
                   <f:facet name="header">
                   <rich:columnGroup>
                   <h:column>
                   </h:column>
                   <h:column>
                   <s:link styleClass="texto_branco"
                   value="#{resourceAtor.atorLabelNome} #{atorList.order=='txNome asc' ? messages.down : ( atorList.order=='txNome desc' ? messages.up : '' )}">
                   <f:param name="order"
                   value="#{atorList.order=='txNome asc' ? 'txNome desc' : 'txNome asc'}" />
                   </s:link>
                   </h:column>
                   <h:column>
                   <s:link styleClass="texto_branco"
                   value="#{resourceAtor.atorLabelNivel} #{atorList.order=='nbNivelAtor asc' ? messages.down : ( atorList.order=='nbNivelAtor desc' ? messages.up : '' )}">
                   <f:param name="order"
                   value="#{atorList.order=='nbNivelAtor asc' ? 'nbNivelAtor desc' : 'nbNivelAtor asc'}" />
                   </s:link>
                   </h:column>
                   <h:column>
                   </h:column>
                   </rich:columnGroup>
                   </f:facet>
                   <h:column>
                   </h:column>
                   <h:column>
                   <s:link view="/faces/ator/Ator.xhtml" styleClass="edite"
                   value="#{ator.txNome}">
                   <f:param name="atorIdAtor" value="#{ator.idAtor}" />
                   </s:link>
                   </h:column>
                   <h:column>
                   <s:link view="/faces/ator/Ator.xhtml" styleClass="edite"
                   value="#{ator.nbNivelAtor}">
                   <f:param name="atorIdAtor" value="#{ator.idAtor}" />
                   </s:link>
                   </h:column>
                  
                   <h:column>
                   <a:commandButton styleClass="bt_deletar"
                   actionListener="#{atorHome.recuperarAtor}"
                   onclick="Richfaces.showModalPanel('mp',{width:450, top:200})"
                   title="#{msg.APP_TITLE_BOTAO_EXCLUIR}" alt="#{msg.APP_TITLE_BOTAO_EXCLUIR}">
                  
                   <f:attribute name="atorIdAtorDelete" value="#{ator.idAtor}" />
                   <s:conversationPropagation type="join" />
                  
                   </a:commandButton>
                   </h:column>
                   <f:facet name="footer">
                   <rich:datascroller id="atorListDataScroller"
                   for="atorList"
                   maxPages="10"
                   binding="#{atorList.datascroller}"/>
                   </f:facet>
                   </rich:dataTable>
                   <rich:spacer height="10" />
                  
                  
                   <fpf:confirmarAcao cabecalho="#{msg.APP_CONFIRMAR_DELETE_DIALOG}" mensagem="#{msg.APP_MSG_CONFIRMAR_DELETE}" >
                   <ui:define name="actionButton">
                   <a:commandButton value="#{msg.APP_BOTAO_SIM}" action="#{atorHome.remove}"
                   onclick="javascript:Richfaces.hideModalPanel('mp')" reRender="atorList, atorListDataScroller, tese, generalMessages" />
                   </ui:define>
                   </fpf:confirmarAcao>
                  
                   </a:form>
                   <h:form>
                   <s:button styleClass="bt_novo" action="#{atorHome.createNew}"
                   id="create" rendered="#{empty from}">
                   <f:param name="atorIdAtor"/>
                   </s:button>
                   </h:form>
                   </ui:define>
                  </ui:composition>
                  


                  can you help me ?? is the anything wrong ?




                  • 6. Re: DataScroller Problem
                    Diego Coronel Apprentice

                    so, i got a stupid solution,

                    <a4j:commandButton id="search" value="Search5" action="#{authenticator.teste}" oncomplete="A4J.AJAX.Submit('_viewRoot','paisSearch',event,{'ignoreDupResponses':true,'parameters':{'paisSearch:paisList:scrol':'1'} ,'eventsQueue':'paisSearch:paisList:scrol','actionUrl':'/fmtam_idoctor_web/faces/pais/pesquisar.seam'} );" />

                    this is so crazy, anyone know another way to use datascroller with ajax ??

                    • 7. Re: DataScroller Problem
                      Diego Coronel Apprentice

                      so, anyone with this problem ? just me using ajax with datascroller ? i need help.........

                      • 8. Re: DataScroller Problem
                        Diego Coronel Apprentice

                        ?? im with problem yet ... anyone from rich faces team know how to make it work ?

                        • 9. Re: DataScroller Problem
                          Diego Coronel Apprentice

                          should i open a bug for this ?