Reputation: 362
I am using below code to generate jsTree with jQuery 2.1.3.
var json = JSON.stringify(tree.nodes);
var arrayCollection = [{id:"1",parent:"#",text:"Test1"},{id:"2",parent:"1",text:"Test2"}];
$('#jstree_demo_div').jstree({
'core': {
'data': json
}
});
If I use json
instead of arrayCollection
it is thowing me an error:
Uncaught Error: Syntax error, unrecognized expression: [{"id":"1","parent":"#","text":"test"}] jQuery.min.js 2
arrayCollection
is same and copied from console.log(json)
but it is not working dynamically with data attribute of jsTree.
Please suggest what is going wrong here.
Upvotes: 0
Views: 456