mercredi 10 mai 2017

jsTree : Getting value of all checked (and partial checked) nodes

So, I have the following simple treeview with checkbox applied:

enter image description here

I have the following code, this brings back the value and length of the selected/ clicked checkbox (the one with the tick in it):

r[0] = data.instance.get_node(data.selected[i]).text.trim();
r[1] = data.instance.get_node(data.selected[i]).parents.length;

However, I also need to bring back the same information for those checkboxes which are the parents of that selected node and are identified with the square check within them....whilst also removing duplicates.

I have tried using:

data.instance.get_path(data.node,'/');

This brings back the path of any selected node but I cannot fathom how to bring back the length and value of the parent nodes!!!

Any feedback and suggestions welcomed.




Aucun commentaire:

Enregistrer un commentaire