array of selected checkboxes

Hi,

In a dhtmxgrid that I rendered, I need to be able to get an array of selected checkboxes… somehow, mygrid.getSelectedId() doesn’t seem to work. Here’s the code for your ref.:

<script>
 
 var OptimisedModelGrid;
  function loaddata()
   {
    
    buildgrid1();
        
  }
   
  function buildgrid1()
  {
      OptimisedModelGrid= new dhtmlXGridObject(‘optimisedviewmodel’);
    OptimisedModelGrid.imgURL = ‘dhtmlxgrid/dhtmlxGrid/codebase/imgs/icons_greenfolders/’;
    OptimisedModelGrid.setHeader(‘Check,GroupName,Remarks’);
    OptimisedModelGrid.setInitWidthsP(‘20,*,20’);
    OptimisedModelGrid.setColTypes(‘ch,ro,ro’);
    OptimisedModelGrid.enableCollSpan(true);
    OptimisedModelGrid.setSkin(‘mod6’)
    //OptimisedModelGrid.chNoState = ‘0’;//‘0’ will be ‘unchecked’, all other values will be ‘checked’
    OptimisedModelGrid.init();
    OptimisedModelGrid.loadXML(‘optimisedviewresult.do’);
  }
 
  function republish()
  {
  //to send the selected groups to again to republish the
  //need to call a DB proc to skip selected groups
  //skip(modelId, listOfGroups)


  var ch = OptimisedModelGrid.getSelectedId().split(’,’);

  alert(ch);

  }
</script>

It only gives the selected rowid if and only if I click in the cell and not check the checkbox… any ideas? thanks.

getSelectedId returns list of selected rows, if you need to get rows with checked checkboxes, you can use getCheckedRows

var ar = grid.getCheckedRows(0).split(",")