Skip to content

Instantly share code, notes, and snippets.

@celsoagra
Last active January 29, 2019 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celsoagra/65a7ed9b98ae2b232f07cca83c3c3330 to your computer and use it in GitHub Desktop.
Save celsoagra/65a7ed9b98ae2b232f07cca83c3c3330 to your computer and use it in GitHub Desktop.
Example of JSTree
$(function () {
var data = [
{ "id" : "ajson1", "parent" : "#", "text" : "Simple root node" },
{ "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
{ "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
];
$("#jstree").jstree({
"core" : {
"themes" : { "variant" : "large" },
"check_callback" : true,
"data": data
},
"plugins" : [ "sort", "state", "wholerow"]
});
});
<!DOCTYPE html>
<html>
<meta>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
</meta>
<body>
<h1>EXAMPLE JSTREE</h1>
<div id="jstree"></div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script src="app.js"></script>
</html>
@celsoagra
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment