2 Replies Latest reply on Jan 22, 2012 4:00 AM by numay

    problems with datascroller

    numay

      hello

       

      i am newbie in jsf ...

       

      and while i am practicing with rich faces components i faced a small problem with ( dataScroller)

       

      the problem is i am using a data table of books  the first column contains checkboxes and the second column has books names

       

      and it allows user to select from the displayed books

       

      here is my jsf code:

       

       

       

       

      
      <%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
      <%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
      <%@ taglib prefix="rich" uri="http://richfaces.org/rich" %>
      <%@ taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
                <head>
                          <title> .: View Books By Author Name :.</title>
                </head>
                <body>
                          <f:view>
                                    <f:loadBundle basename="com.simulation.messages" var="message"/>
      
                                              <h1>Books by Author Name</h1>
                                              <br>
                                              <hr>
                          <ui:composition xmlns="http://www.w3.org/1999/xhtml" 
                                    xmlns:h="http://java.sun.com/jsf/html"
                                   xmlns:f="http://java.sun.com/jsf/core" 
                                   xmlns:ui="http://java.sun.com/jsf/facelets" 
                                   xmlns:a4j="http://richfaces.org/a4j" 
                                   xmlns:rich="http://richfaces.org/rich">
      
                                        <h:form id="form">
                                            <h:panelGrid columnClasses="acent">                                       
                                                <rich:dataTable value="#{BookBean.listOfBooks}"   var="list"   id="table"   rows="10"   style="   width : 245px;"
                                                                         onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                                                                  onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                                                    <rich:column >
                                                        <f:facet name="header">
                                                            <h:outputText value="select" />
                                                        </f:facet>
                                                        <h:selectBooleanCheckbox value="#{list.selected}"  />
                                                    </rich:column>
      
                                                    <rich:column>
                                                        <f:facet name="header">
                                                            <h:outputText value="BookName" />
                                                        </f:facet>
                                                        <h:outputText value="#{list.name}" />
                                                    </rich:column>
      
                                                             <rich:datascroller for="table" maxPages="4" />
                                                </rich:dataTable>
      
                                            </h:panelGrid>
      
                                              <h:commandButton  action="#{BookBean.borrowBook}" value="#{message.button_text}"/>
                                        </h:form>
                           </ui:composition>
      
                          </f:view>
                </body>
      </html>
      
      
      

       

      the list in datatable value :


       

      <rich:dataTable value="#{BookBean.listOfBooks}"


       

      is list of objects , this object include ... id (int) name (String) selected(boolean)


       

       

      so i have two problems with my datatable & datascrolle

       

      - first problem when i try to get data from the database ( about 80000+ record Description: https://community.jboss.org/4.5.6/images/emoticons/happy.gif )  the datascroller takes about 27 seconds to go from one page to an other  ( i do not know why !!)


       

      - my second problem is when i check boxes in first page then move to the second page ... after that when i come back to the first page i do not see any boxes selected

       

      and i did some search about this problem...


       

      some answers were about inserting ( execute="@form"  or execute="table id") and when i do that , it shows me an error :


       

      Attribute execute invalid for tag datascroller according to TLD


       

      i am using 

       

      rich faces 3.3

       

      jboss 4.2.2

       

      and jsf 1.2

       

      thank you in advance .

        • 1. Re: problems with datascroller
          mcmurdosound

          No: "execute="@form"  or execute="table id"" is for JSF 2 and later only!

           

          You should try something like this:

           

          <h:selectBooleanCheckbox value="#{list.selected}" >

          <a4j:support event="onchange" />

          </h:selectBooleanCheckbox>

           

           

          An for your performance problems: you should use a server side pagination, but this is a bit more complicatet than using the buildin clientside pagination of the datascroller.

          • 2. Re: problems with datascroller
            numay

            many thanks Christian

             

            i inserted  the a4j tag .. and it is working now

             

            and i am gonna read about server side pagination

             

            many many thanks to you