Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dmitry on Feb 20, 2008 02:26
open dhtmlx forum
TreeGrid check kids

Hello!

how can i check all kids checkbox in column if parent's this column checkbox was checked?
Answer posted by Support on Feb 20, 2008 05:35
You can use onCheckbox event to detect moment when row checked, and getSubItems method to get all child items

mygrid.attachEvent("onCheckbox", function(id,index,state){
    var kids = mygrid.getSubItems(id).split(",");
    for (var i=0; i<kids.length; i++)
         mygrid.cells(kids[i],index).setValue(state?1:0)
    return true;
});