2 Replies Latest reply on Feb 6, 2009 4:26 AM by Markus Dahm

    dataTable and dataScroller not update correctly

    Markus Dahm Novice

      Hi,

      I'm not sure whether the following is related to Seam or rather a RichFaces Bug, but maybe you have a clue anyway...

      Settings:
      - Seam 2.0.2.SP1
      - RichFaces 3.3.0.GA

      I've got a search page with multiple panels: One with the search filters, one with the result data table, and one for details. The following scenario does not work:

      1. Perform some search yields many results (more than 10 in my case)
      2. Use the datascroller to go to some other page of the result list
      3. Do another search that yields much fewer results, i.e. less than 10

      The output says "...7 hits", but the data table is not updated, i.e. is empty. I strongly suspect some Richfaces bug here. As you will see I omit the datascroller, if the result set is too small, but
      I think the data table should be updated anyway...?
      Here's the code:

      Bean:

      @Stateful
      @Conversational
      @Name(SearchForm.NAME)
      public class SearchFormBean implements SearchForm {
       ...
       private List<SearchResultViewData> _searchResult = Collections.emptyList();
       private int _resultSize = 0;
       private int _page = 1;
      
       public final List<SearchResultViewData> getSearchResults() {
       log.debug("getSearchResults #0", _resultSize);
       return _searchResult;
       }
      
       public final void search() {
       _searchResult = ...
       _resultSize = _searchResult.size();
       _page = 1;
       }
      
       public final int getResultSize() {
       return _resultSize;
       }
      
       public final int getPage() {
       return _page;
       }
      
       public final void setPage(final int page) {
       _page = page;
       }
      
       @Remove
       @Destroy
       public void destroy() {
       log.debug("Search form destroyed");
       }
      }
      


      XHTML:

      <div 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.org/rich"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:a="http://richfaces.org/a4j">
       <rich:simpleTogglePanel
       label="#{searchForm.resultSize} Hits" switchType="client">
      
       <rich:dataTable id="resultList" value="#{searchForm.searchResults}"
       rowClasses="even,odd" var="arzt" rows="10">
      
       <rich:column>
       ...
       </rich:column>
      
       </rich:dataTable>
      
       <rich:spacer height="15" />
      
       <rich:datascroller bypassUpdates="true" align="center" for="resultList" maxPages="20"
      rendered="#{searchForm.searchResults.size() >= 10}"
       page="#{searchForm.page}" />
      </rich:simpleTogglePanel></div>
      


      Thanks in advance
      Markus