I am doing jsTree this way:
$("#myTree").jstree({ "plugins": ["themes", "json_data", "ui", "crrm", "dnd"], "themes": { "theme": "default", "dots": false, "icons": false, "url": "../../Content/jsTreeThemes/default/style.css" }, "json_data": { "data" : [] } });
And the user sees the page with empty jsTree. I have to initialize jsTree when the user does some action. But I do not use ajax initialization (I do not use "ajax" in "json_data"). I have to initialize my jsTree using only the following line:
var stringJSON = [{ "attr": { "id": "1", "rel": "root", "mdata": null }, "data": "title": "root_jsTree", "icon": null }, "state": "open", "children": [{ "attr": { "id": "7", "rel": "folder", "mdata": null }, "data": { "title": "1", "icon": null }, "state": "", "children": [{ "attr": { "id": "10", "rel": "folder", "mdata": null }, "data": { "title": "leaf", "icon": null }, "state": "", "children": [] }] }, { "attr": { "id": "8", "rel": "folder", "mdata": null }, "data": { "title": "leaf", "icon": null }, "state": "", "children": [{ "attr": { "id": "9", "rel": "folder", "mdata": null }, "data": { "title": "leaf", "icon": null }, "state": "", "children": [] }] }] }]'
No matter how I get this line, when the user wants to see the tree, I already had this line. And here I ask the question: how can I initialize jsTree and display it for the user using only the line below.