13 Replies Latest reply on Jan 30, 2009 2:14 AM by e c

    Unable to catch selected line in a scrollableDataTable

    Ker P Newbie

      Hi,

      I'm new with JSF and RichFaces, but searched a lot (without any success) before posting this thread.
      In fact I tried to use this example from the live demo :

      http://livedemo.exadel.com/richfaces-demo/richfaces/scrollableDataTable.jsf?c=scrollableDataTable
      
      My problem : I am not able to "catch" the selected line of the scrollableDataTable.
      
      
      My configuration :
      - Eclipse GanyMede
      - jre1.6.0_07
      - Tomcat 6.0.16
      - JSF 1.2
      - RichFaces 3.2.1 GA
      
      Here is my jsp caseList.jsp
      
      
      <rich:scrollableDataTable
       rowKeyVar="rkv"
       frozenColCount="1"
       sortMode="single"
       selection="#{caseList.selection}"
       id="caseList"
       columnClasses="col"
       value="#{caseList.caseList}"
       var="case">
       <rich:column id="popcolumn1">
       <f:facet name="header">
       <h:outputText id="popheaderText1" styleClass="headerText" value="#{msg.machine}"/>
       </f:facet>
       <h:outputText value="#{case.machine}">
       </h:outputText>
       </rich:column>
      ....
      </rich:scrollableDataTable>
      
      
      
      
      Here is my bean caseListBean.java
      
      
      public class CaseListBean {
       private List<CaseList> caseList = new ArrayList<CaseList>();
       private SimpleSelection selection = null;
       private ArrayList<CaseList> selectedCaisses = new ArrayList<CaseList>();
      
       public SimpleSelection getSelection() {
       return selection;
       }
       public void setSelection(SimpleSelection selection) {
       this.selection = selection;
       }
      
       public ArrayList<CaseList> getSelectedCaisses() {
       return selectedCaisses;
       }
       public void setSelectedCaisses(ArrayList<CaseList> selectedCaisses) {
       this.selectedCaisses = selectedCaisses;
       }
      
       public String takeSelection() {
       getSelectedCaisses().clear();
       Iterator<Object> iterator = selection.getKeys();
       System.out.println("(CaseListBean.takeSelection) key.size()["+selection.size()+"]");
       while (iterator.hasNext()){
       SimpleRowKey key = (SimpleRowKey)iterator.next();
      
       getSelectedCaisses().add(caseList.get(key.intValue()));
       }
       return null;
       }
      
      
      }


      Each time, the size of the selection is 0 (even if I have one line selected)...

      Thanks for your help!