2 Replies Latest reply on Apr 7, 2008 9:22 AM by Ilya Shaikovsky

    Why datascroller show the  confused page order?

    Weifang Tang Newbie

      Hi,
      I'm using richfaces3.1.0 and myfaces1.1.1.
      When I used rich:datascroller in my page, I found that it didn't work as
      it should. When the 'next' button is clicked, sometime it did nothing, and
      sometime, it retrieved a previous page.

      Thank you for reading.

      <f:view>
       <h:form>
       <h:panelGrid columns="1">
       <rich:datascroller for="bookTable" pageIndexVar="page"
       oncomplete="resetStatus();" align="left" />
       <rich:spacer height="30"/>
       <rich:dataTable id="bookTable" value="#{bookstoreBean.books}"
       var="book" rows="10" border="1" rowKeyVar="rowIndex"
       columnsWidth="100, 100, 100,100,100,100">
      
       <h:column>
       <f:facet name="header">
       <h:outputText value="Title"/>
       </f:facet>
       <h:outputText value="#{book.title}"></h:outputText>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="Author"/>
       </f:facet>
       <h:outputText value="#{book.author}"></h:outputText>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="Price"/>
       </f:facet>
       <h:outputText value="#{book.price}"></h:outputText>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="Selected"/>
       </f:facet>
       <h:outputText value="#{book.selected}"></h:outputText>
       </h:column>
       </rich:dataTable>
       </h:panelGrid>
       </h:form>
      </f:view>
      


        • 1. Re: Why datascroller show the  confused page order?
          Weifang Tang Newbie

           

          package test;
          
          import java.util.ArrayList;
          import java.util.Iterator;
          import java.util.List;
          import java.util.Set;
          
          import javax.faces.model.SelectItem;
          
          import org.richfaces.component.html.HtmlDatascroller;
          
          
          public class BookstoreBean {
           private List books;
           private Set ajaxKeys;
           private SelectItem[] items;
           private List selectedBooks;
           private HtmlDatascroller scroller;
           public BookstoreBean()
           {
          
           selectedBooks=new ArrayList();
           }
           public Set getAjaxKeys()
           {
          
           return ajaxKeys;
           }
          
           public void setAjaxKeys(Set ajaxKeys)
           {
           this.ajaxKeys = ajaxKeys;
           }
          
           public SelectItem[] getItems()
           {
           if (items==null)
           { int n = books.size();
           items=new SelectItem[n];
          
           for (int i = 0; i < n; i++)
           items= new SelectItem(Integer.toString(i));
           }
           return items;
           }
          
           public void setItems(SelectItem[] items)
           {
           this.items = items;
           }
          
           public List getBooks()
           {
           if (books != null) return books;
           books = new ArrayList(100);
           for (int i = 1; i < 100; i++)
           {
           books.add(
           new Book("Book"+i, "Author"+i,
           100, false)
           );
           }
           return books;
           }
          
           public void setBooks(List books)
           {
           this.books = books;
           }
           public void printSelected()
           { System.out.println("These books are selected:");
           for (Iterator iter=selectedBooks.iterator(); iter.hasNext(); )
           System.out.print("BOOK"+iter.next()+", ");
           System.out.println();
           }
           public List getSelectedBooks()
           {
           return selectedBooks;
           }
           public void setSelectedBooks(List selectedBooks)
           {
           this.selectedBooks = selectedBooks;
           }
           public HtmlDatascroller getScroller()
           {
           return scroller;
           }
           public void setScroller(HtmlDatascroller scroller)
           {
           this.scroller = scroller;
           }
           }
          


          • 2. Re: Why datascroller show the  confused page order?
            Ilya Shaikovsky Master

            please update your version to 3.1.4 GA