javascript - How to get checked nodes in jquery jstree -
i have created 1 jquery jstree , it's working fine. problem how the checked nodes details.
for creating jstree 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 need attributes values checked elements. "tags" json object looks {"data":"tags","id":30,"pid":0}, if user select tag need value of "data" , "id". have tried write code unfortunately 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 solution.
function submitme(){ var checked_ids = []; $("#server_tree").jstree("get_checked",null,true).each (function () { checked_ids.push(this.id); }); dostuff(checked_ids);
go through once jstree google groups
Comments
Post a Comment