0 Replies Latest reply on Mar 25, 2008 2:46 AM by srinivasan muthu

    Rerender scrollable datatable after scrolling thows error

    srinivasan muthu Newbie

      I use Seam, Richfaces 3.1.4.GA.

      I am trying to show different resultsets based on the link the user clicks.

      I get an illegalargument exception when I do the following:
      1) user clicks one link1, I show 3 tables in tabs
      2) user scrolls in one of the table to retrieve more rows via AJAX
      3) user clicks on link2
      Exception is thrown

      I guess the datamodel has changed after link2 is clicked but the view state is still remembering the old index (after scrolling of first table).

      How do I clear the view for every click of the link and the old view is not remembered.

      Here is the code:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">

      <h:messages styleClass="message"/>

      <h:form id="reports">

      <rich:panel>

      <a4j:commandLink id="id1" value="Report1" ajaxSingle="true" reRender="tablePanel">
      <a4j:actionparam name="reportId"
      assignTo="#{reportCardTree.selectedReportCardNodeId}"
      value="4" />
      </a4j:commandLink>



      <a4j:commandLink id="id2" value="Report2" ajaxSingle="true" reRender="tablePanel">
      <a4j:actionparam name="reportId"
      assignTo="#{reportCardTree.selectedReportCardNodeId}"
      value="5" />
      </a4j:commandLink>



      <a4j:outputPanel id="tablePanel">

      <rich:tabPanel switchType="ajax">

      <c:forEach items="#{reportCardTree.selectedReportCardNode.reports}" var="report" varStatus="stat">

      <rich:tab label="#{report.title}">
      <rich:panel style="width:100%">

      <rich:scrollableDataTable frozenColCount="1" height="400px" cellpadding="4" cellspacing="2"
      rows="50" sortMode="single" var="rowItem" value="#{report.resultList}"
      width="100%" onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
      onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">

      <c:forEach items="#{report.columns}" var="column" varStatus="stat">

      <rich:column sortable="false">
      <f:facet name="header">
      <h:outputText value="#{column}"></h:outputText>
      </f:facet>
      <h:outputText value="#{rowItem[stat.index]}" />
      </rich:column>

      </c:forEach>

      </rich:scrollableDataTable>

      </rich:panel>
      </rich:tab>

      </c:forEach>

      </rich:tabPanel>

      </a4j:outputPanel>

      </rich:panel>

      </h:form>
      </ui:composition>


      Exception:

      Caused by java.lang.IllegalArgumentException with message: "fromIndex(110) > toIndex(16)"

      java.util.SubList.(Unknown Source)
      java.util.RandomAccessSubList.(Unknown Source)
      java.util.AbstractList.subList(Unknown Source)
      org.richfaces.model.internal.ComponentSortableDataModel.loadData(ComponentSortableDataModel.java:94)
      org.richfaces.model.DataModelCache.loadData(DataModelCache.java:153)
      org.richfaces.model.ScrollableTableDataModel.walk(ScrollableTableDataModel.java:115)