5 Replies Latest reply on Jul 24, 2008 9:17 AM by Konstantin Mishin

    richfaces ListDataModel

    koen Newbie

      Does someone know what the purpose is of the "org.richfaces.model.impl.ListDataModel" ? I can't seem to find decent information about this class.

      I was trying to put a list of custom objects as 'wrappedData' in a 'ListDataModel' and pass this as the 'value' to the dataTable. This resulted in a classCastException.

      I allready found out that there are two base classes which can be used for extended datamodel support. But it seems to be a little bit heavy to implement all this since I only want to determine the selected row (yes, I could also accomplish this with binding the datatable and the invoking some 'selectedRow' method or something) but I want this to be on the ListDataModel (getRowData)

        • 1. Re: richfaces ListDataModel
          koen Newbie

          Btw; the classCast occurs in "ScrollableTableDataModel" (of which ListDataModel extends) on line 76: public void walk(FacesContext context, DataVisitor visitor, Range range,
          Object argument)

          ScrollableTableDataRange sequenceRange = (ScrollableTableDataRange) range;

          Its a 'SequenceRange' and not a 'ScrollableTableDataRange' which is being passed.

          • 2. Re: richfaces ListDataModel
            Konstantin Mishin Novice

            We need more info about your problem. Attach sources, please.

            • 3. Re: richfaces ListDataModel
              koen Newbie

              Well, there is not much source to it :)

              I have a backingbean 'testBean' which exposes this method:

              public ListDataModel getDataTableModel() {
               ListDataModel model = new ListDataModel();
               List<Person> list = new ArrayList<Person>();
               for (int i = 0; i < 100; i++) {
               Person p = new Person();
               p.setFirstName("firstname " + i);
               p.setName("name " + i);
               model .setWrappedData(list);
               return model;

              Then I have my dataTable, on which binds to the 'testBean' getDataTableModel method:

               <rich:dataTable id="dataTable" value="#{testBean.dataTableModel}" var="row" rows="10">
               <f:facet name="header">
               <rich:column breakBefore="true">
               <rich:datascroller for="dataTable" immediate="true" ajaxSingle="true" />
               <rich:column sortable="true">
               <h:outputText value="#{row.name}"/>
               <rich:column sortable="true">
               <h:outputText value="#{row.firstName}"/>

              The 'person' class just has the 2 properties "name" and "firstName" which are both string and both have get/set accessors.

              • 4. Re: richfaces ListDataModel
                kw wong Newbie


                Has any updated in this issue?

                I have the same problem.

                • 5. Re: richfaces ListDataModel
                  Konstantin Mishin Novice

                  Doesn't use any subclasses of
                  ScrollableTableDataModel as the 'value' to the dataTable.