3 Replies Latest reply on Apr 30, 2009 10:09 PM by Thomas W

    Sorting and selection in scrollableDataTable

    Thomas W Newbie

      Table and server-side state get out of sync when sorting the table. I see the data model is recreated after clicking the sortable header. The table is then rendered from this on-the-fly created model, with proper sorting. But when I select any of the rows, the row index will now refer to the actual source list of the table, which is not sorted. How an I make sure that the backing list is sorted instead of an internally created model to ensure that selection works?


      ModifiableModel$RowKeyWrapperFactory(ObjectWrapperFactory).convertList(List, ObjectConvertor) line: 138
      ModifiableModel$RowKeyWrapperFactory(ObjectWrapperFactory).wrapList(List) line: 175
      ModifiableModel.sort(List<SortField2>) line: 265
      ModifiableModel.modify(List, List<SortField2>) line: 234
      HtmlScrollableDataTable(UIScrollableDataTable).createDataModel() line: 223
      HtmlScrollableDataTable(UIDataAdaptor).getExtendedDataModel() line: 621
      HtmlScrollableDataTable(UIDataAdaptor).getRowCount() line: 248

      <rich:scrollableDataTable id="scrollableTestTable"
       value="#{EdtTestBean.rowIds}" var="rowId" selectionMode="multi"
       tableState="#{EdtTestBean.tableState}"
       selection="#{EdtTestBean.selection}" selectedClass="selected"
       rowClasses="tablerow1,tablerow2" columnsWidth="0*" width="100%"
       height="308px">
      
       <rich:columns id="#{col.name}" value="#{tableColumns}" var="col"
       index="colIndex" label="#{col.description}" sortable="true"
       sortExpression="#{EdtTestBean.getRow(rowId)[colIndex].value}"
       sortIconAscending="dataTableAscIcon"
       sortIconDescending="dataTableDescIcon">
       <f:facet name="header">
       <h:outputText value="#{col.description}" />
       </f:facet>
       <h:outputText value="#{EdtTestBean.getRow(rowId)[colIndex].value}" />
       </rich:columns>
      </rich:scrollableDataTable>