2 Replies Latest reply on May 27, 2010 11:16 PM by shanika Dias

    rich:extendedDataTable with select all rows functionality via a check box

    shanika Dias Newbie



      I am having a extendedDataTable and i'm trying to do a select all via a check box that's outside the table.  When a user clicks on the check box to select all, all the records must get selected.


      Everything works fine until i use the select all check box to select all records and then  ctrl + mouse click to deselect a row. Though the clicked row gets deselected in the gui, my takeSelection() method returns 0 records though the rest of the records are shown as selected in the gui.


      here's the code :


      <h:selectBooleanCheckbox id="checkBoxSelection" value="#{ToDo.selectAllClicked}" title="Select All">
         <a:support event="onclick" action="#{ToDo.selectAllValueChanged()}" ajaxSingle="true" reRender="toDoListPanel"/>




      <a:outputPanel id="toDoListPanel">

                <rich:extendedDataTable id="toDoTable" value="#{itemsToDo}" var="todo" headerClass="thfmt" style="width:100%;" 

                  selectionMode="multi" selection="#{ToDo.selection}" rendered="#{itemsToDo.rowCount > 0}">




               <a:support event="onselectionchange" ignoreDupResponses="true" requestDelay="500" ajaxSingle="true" action="#ToDo.takeSelection}" />





      in my java code :


      private ArrayList<RuleVersion> selectedItems = new ArrayList<RuleVersion>();

      private SimpleSelection selection = new SimpleSelection();  

      private boolean selectAllClicked = false;



      public String takeSelection() {      
             Iterator<Object> iterator = getSelection().getKeys();
             while (iterator.hasNext()) {
                 Object key = iterator.next();

             return null;
          public void selectAllValueChanged(){
          // If all selected copy all else clear all items
            if (selectAllClicked == true){ 
               for (RuleVersion r : todo){


      What am i missing here?