131
Views
2
Comments
[zTree] Getting the data out
Question
ztree
Web icon
Forge asset by Eduardo Luís
Now I have this beautiful tree with checkboxes, and when the user pressers the Save button I'd like to know the checkbox statusses from the tree (either at that moment, or dynamically during the checking). What would be the best way to do this?
UserImage.jpg
Eduardo Luís
Hello again,

for that you have to put the tree "talking" with the server. 
Both ways are possible (the Save button or during the checking).
For the first option you can use the 'getChangeCheckedNodes', 'getCheckedNodes', 'getUnCheckedNodes' actions. See the 'Statistics Checkbox is Checked' example.
For the second option you will have to use callback functions namelly 'beforeCheck' and/or 'onCheck'. There are lots of examples where the tree "talks" with the server but the one closest that you want is the 'Checkbox -zTree Methods' example.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Ok, thanks very much, I'll check it out.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.