javascript - New to jstree basics -
i have started using jstree project. have looked @ documentation on jstree website , have come simple tree:
<div id="jstree_test"></div> <script> $(function () { $('#jstree_test').jstree({ core: { data: [ { id: 'parent1', parent: '#', text: 'p1' }, { id: 'child1', parent: 'parent1', text: 'c1' }, { id: 'child2', parent: 'parent1', text: 'c2' }, { id: 'child3', parent: 'parent1', text: 'c3' } ] } }); }); </script>
when run code, 'p1' bullet point linked itself. desired code p1 3 children c1, c2, , c3. help appreciated.
thanks time
add state property particular node in object.
$('#jstree_test').jstree({ core: { data: [ { id: 'parent1', parent: '#', text: 'p1', 'state' : { 'opened' : true, 'selected' : true } }, { id: 'child1', parent: 'parent1', text: 'c1' }, { id: 'child2', parent: 'parent1', text: 'c2' }, { id: 'child3', parent: 'parent1', text: 'c3' } ] } });
given demo in jsbin -- demo
javascript jstree
No comments:
Post a Comment