jstree get_json returns false

113 views
Skip to first unread message

Dinis D

unread,
Mar 4, 2014, 2:02:30 AM3/4/14
to jst...@googlegroups.com

I'm using jsTree plugin to display tree. The tree is loaded using ajax to a div with ul-li structure. And here is how I initialize it.

$("#jseq_tree").jstree({
      "core" : { "check_callback" : true},
      "plugins" : ["dnd","wholerow"]
}).jstree("open_all");

I'm trying to get all nodes from the tree on a button click like that:

$(document).on("click", "#sub_tree", function() {
    var v =$('#jseq_tree').jstree('get_json', -1);
    var mytext = JSON.stringify(v);
    alert(mytext);
});

But it always alerts false. How can I make it work? Or how can I get all elements of the tree with their ids and children?

Ivan Bozhanov

unread,
Mar 4, 2014, 3:19:24 AM3/4/14
to jst...@googlegroups.com
That is some old code you are using. Instead of this:
$('#jseq_tree').jstree('get_json', -1
);

Use this:
$('#jseq_tree').jstree('get_json');

Best regards,
Ivan
Reply all
Reply to author
Forward
0 new messages