jquery - Jstree not displaying tree -
i trying populate div jstree using json. div, before attempted population looks this:
<div id="maintree"> </div>
the jsontree variable, holds tree, looks (as string. code passes original json object):
"{\"core\":{\"data\":[{\"id\":\"123323\",\"parent\":\"#\",\"text\":\"123323\"},{\"id\":\"54366\",\"parent\":\"#\",\"text\":\"54366\"},{\"id\":\"634766\",\"parent\":\"#\",\"text\":\"634766\"}]}}"
the tree populated this:
$('#maintree').jstree(jsontree);
after script div looks this, content not there. wrong?
<div class="treecontainer" id="treecontainer"> <input class="treesearch" id="treesearch" type="text" placeholder="search" value=""> <div tabindex="0" class="jstree jstree-1 jstree-default jstree-leaf" id="maintree" role="tree" aria-busy="false" aria-multiselectable="true" aria-activedescendant="j1_loading"><ul class="jstree-container-ul jstree-children" role="group"></ul></div> </div>
edit: trying populate tree directly, example jstree, not work either. population done in separate file, imported index.html (last on page).
$('#maintree').jstree({ 'core': { '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" } ] } });
the index.html partially looks (where websocket-handling.js sets maintree).
<html> <head> ... </head> <body> ... <script src="js/jstree.min.js"></script> <script src="js/websocket-handling.js"></script> </body>
Comments
Post a Comment