Created
June 9, 2022 15:20
-
-
Save tararoutray/b63a1e4bdd2974c4941e8eb12d392c9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if the page content has been loaded completely. | |
*/ | |
$(function () { | |
/** | |
* Initialize the jsTree instance on the HTML content. | |
* Display the tree view. | |
*/ | |
$("#tree-view-from-html").jstree(); | |
/** | |
* Initialize the jsTree instance to create tree view | |
* out of JSON content. | |
*/ | |
$("#tree-view-from-json").jstree({ | |
core: { | |
/** | |
* Add the JSON content inside the "data" attribute. | |
*/ | |
data: [ | |
{ | |
text: "JSON Node 1", | |
state: { | |
opened: true, | |
}, | |
children: [ | |
{ | |
text: "JSON Node 1.1", | |
}, | |
{ | |
text: "JSON Node 1.2", | |
}, | |
{ | |
text: "JSON Node 1.3", | |
}, | |
{ | |
text: "JSON Node 1.4", | |
}, | |
{ | |
text: "JSON Node 1.5", | |
}, | |
], | |
}, | |
{ | |
text: "JSON Node 2", | |
state: { | |
opened: true, | |
}, | |
children: [ | |
{ | |
text: "JSON Node 2.1", | |
}, | |
{ | |
text: "JSON Node 2.2", | |
}, | |
{ | |
text: "JSON Node 2.3", | |
}, | |
{ | |
text: "JSON Node 2.4", | |
}, | |
{ | |
text: "JSON Node 2.5", | |
}, | |
], | |
}, | |
], | |
}, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment