Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by MIS Webmaster on Mar 07, 2008 07:43
open dhtmlx forum
More information on selects

Let's say i have multiple branches

[ ] Tree
|-----[X] Vegetables
| |----- [ ] Carrots
| |----- [ ] Potato
| |----- [ ] Eggplants
|-----[ ] Fruits
|----- [ ] Apples
|----- [ ] Bananas
|----- [X] Grapes

I am working with the Three States checkbox. I would like that if an entire branch is selected like Vegetables above, to have only the Userdata of the "Vegetables" parent node returned and not the one from "Potato","Carrot" or "Eggplant". Otherwise if only a child node is checked like "Grapes" then only return the userdata from that. So when i would save this tree. I would only save the "Vegetables" and "Grape" node userdata.
Answer posted by support on Mar 10, 2008 07:21
When you check the parent node, its children become checked too.  And getAllChecked method will return list of ids of all checked items (with children).

If you need to get only item which is checked by user,  you can try to use "onCheck" event handler:

tree.attachEvent("onCheck",function(id,state){
      
    // your code here  

})