Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Drew on Apr 23, 2008 06:03
open dhtmlx forum
Check All / Uncheck All Functionality?

Hi,

I'm putting the finishing touches on my checkbox tree, and need two buttons: "Check All" and "Uncheck All". Could you help me to figure this out before I purchase this script?

I'm not a Javascript expert, but I figured out the Expand All feature tree.openAllItems(0);

Now I just need a Check All Feature

Cheers,

Drew
Answer posted by Support on Apr 23, 2008 06:17
There is no ready to use methods but you can use  next code snippets

to check all
    var ids=tree.getAllSubItems(0).split(",");   // get IDs of all items
    for (var i=0; i<ids.length; i++)                  // for each item
       tree.setCheck(ids[i],1);                        // set check

to uncheck all
    var ids=tree.getAllSubItems(0).split(",");
    for (var i=0; i<ids.length; i++)
       tree.setCheck(ids[i],0);