2 Replies Latest reply on Jun 19, 2010 2:06 AM by Martin Dames

    extendedDataTable: takeSelection on row selection

    Martin Dames Newbie

      Hi there,


      I'd like to select a row in my extendedDataTable and to set the selected object in my Action, this should be done with Ajax.


      Here is what I did:


      <rich:extendedDataTable
         value="#{personPool}" var="_per" id="table"
          sortMode="single"
          width="280px" height="200px"
          selectionMode="single"
          selection="#{selection}">
          <rich:column sortable="false" label="Flag" id="col_1">
             <f:facet name="header">
                 <h:outputText value="Lastname" id="flag"/>
             </f:facet>
             <h:outputText value="#{_per.lastName}" id="lastName"/>
          </rich:column>
         <a:support event="onselectionchange" action="#{myAction.takeSelection(_per)}" reRender="outputPanel" />
      



      Here is my Action


      ...
      @DataModel(scope = ScopeType.PAGE)
           private List<Person> personPool;
      
      public void takeSelection(Person person1) {
                System.out.println("takeSelection...");
                System.out.println(person1);
      }
      ...
      



      This does not work! I will get a null value passed to takeSelection.


      If Im adding a third column with a link, e.g.:


      <rich:column sortable="false" label="Hund" id="col_3">
         <f:facet name="header">
           <h:outputText value="Select" id="flag2"/>
         </f:facet>
         <s:link id="view1Hotel" value="View Person">
              <a:support event="onclick" action="#{doiAction.takeSelection(_per)}" reRender="outputPanel, firstNameInput, secondNameInput, lastNameInput, titleInput, emailInput, telephoneInput, faxInput, institutesInput" />
         </s:link>
      </rich:column>
      



      it will work, but that is not what my client want. I need a way to select just the row, display the person values, etc.


      Thank you for advice!