Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
188
rated 0 times [  189] [ 1]  / answers: 1 / hits: 34632  / 11 Years ago, fri, august 16, 2013, 12:00:00

I have created one jquery jstree and it's working fine. Now the problem is how to get the the checked nodes details.




For Creating JStree The code is:




$(function () {
$(#tree).jstree({
json_data : {
data : [
{data:pe_opensourcescanning,id:0,pId:-1,children: [{data:tags,id:30,pid:0},{data:branches,id:29,pid:0},{data:trunk,id:1,pid:0,children:[{data:import-export,id:28,pid:1},{data:custom_development,id:12,pid:1},{data:Connectors,id:7,pid:1},{data:support,id:6,pid:1},{data:Installation-Configuration,id:5,pid:1},{data:backup,id:2,pid:1}]}]}
]
},
plugins : [ themes, json_data, checkbox, ui ]
}).bind(select_node.jstree, function (e, data) { alert(data.rslt.obj.data(id)); });


Now while getting checked nodes i need all the attributes values for those checked elements. Say like for tags the json object looks like {data:tags,id:30,pid:0}, so if user select tag i need the value of data And id. i have tried to write some code but unfortunately that is not working.




Getting Checked Nodes.




$(# +div2.childNodes[i].id).jstree(get_checked,null,true).each 
(function () {
alert(this.data);
alert(this.id);

});


Kindly give me a solution.


More From » jquery

 Answers
6
  function submitMe(){ 
var checked_ids = [];
$(#server_tree).jstree(get_checked,null,true).each
(function () {
checked_ids.push(this.id);
});
doStuff(checked_ids);


Go through this once
jstree google groups


[#76318] Thursday, August 15, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cruzs

Total Points: 710
Total Questions: 113
Total Answers: 100

Location: Nepal
Member since Sat, Jul 18, 2020
4 Years ago
;