3 Replies Latest reply on Mar 12, 2010 10:47 AM by Eugene Bessel

    SerializableDataModel and takeSelection

    Eugene Bessel Newbie

      Hello everyBody.

       

      I try to implement the posibility, that the customer can select one row of the table.

       

      when I extend my model from ExtendedDataModel, then the method setSelection and then takeSelection are called.

       

      but when I extend my model from SerializableDataModel, then these methods are not called.

       

      <rich:dataTable value="#{myDataTable}" var="data" id="extTable"
              width="700px" height="600px" sortMode="single" selectionMode="single"
              tableState="#{myDataTable.tableState}"
              selection="#{myDataTable.selection}" rows="15" status="commonstatus">
              <f:facet name="header">
                  <h:outputText value="#{userbbean.tableHeader}"></h:outputText>
              </f:facet>
              <a4j:support event="onRowClick" action="#{myDataTable.takeSelection}" immediate="true" reRender="test"/>
              <rich:columns id="col_#{col}" value="#{myDataTable.columns}"
                  selfSorted="true" sortBy="#{data[ind]}" sortOrder="#{myDataTable.sortOrders[col]}"
                   var="col" index="ind" filterMethod="#{myDataTable.filterData}">
                  <f:facet name="header">  

       

      My Bean:

      public class MyDataTable extends SerializableDataModel{

       

      public SimpleSelection getSelection() {
              System.out.println("get Selection");
              return selection;
          }

       

          public void setSelection(SimpleSelection selection) {
              System.out.println("set Selection" + selection);
              this.selection = selection;
          }
         
          public void takeSelection() {
              Selection sel = getSelection();
              System.out.println("take Selection");
              Iterator<Object> i = getSelection().getKeys();
              while (i.hasNext()) {
                  Object key = i.next();
                  this.setRowKey(key);
                  if (this.isRowAvailable()) {
                      return;
                  }
              }
              comboColumn="halloooo";
      //        return null;
          }

       

      does anybody have an Advice what shoud I change when I use SerializableDataModel????