Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by MIS Webmaster on Mar 07, 2008 07:17
open dhtmlx forum
Selecting parent nodes

I am working on a large tree, the way i need it to work, is that if a parent node has been selected, only it is returned and none of its children. Is there a way to accomplish that ?

Ex

Vegetables (Userdata: vg-100)
|-------- Potato
|-------- Carrot
|-------- Eggplant

If the Vegetable branch is selected, i would only like to retrieve the userdata of Vegetables
Answer posted by Support on Mar 07, 2008 07:31
The API of tree allows to get list of checked items, but it is not possible to "serialize only checked" items.

get list of checked
       var ids=tree.getAllChecked();
       ids=ids.split(",")
       for (var i=0; i<ids.length; i++)
          alert(tree.getUserData(ids[i],"somedata"))