Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Apr 18, 2008 10:56
open dhtmlx forum
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&gt;
 
 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&gt;

It only gives the selected rowid if and only if I click in the cell and not check the checkbox.. any ideas? thanks.
Answer posted by Support on Apr 21, 2008 01:46
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(",")