2 title: Javascript tree with multiple select
4 js: examples/multiple_select.js
9 <a href="../07_autoscroll/">« Example 7</a>
10 <a href="../09_custom_html/" class="next">Example 9 »</a>
13 <h1>Example 8 - multiple select</h1>
17 This example implements multiple select using the following functions and events:
21 <strong>addToSelection</strong>: add node to selections
24 <strong>isNodeSelected</strong>: is this node selected?
27 <strong>removeFromSelection</strong>: unselect this node
30 <strong>tree.click event</strong>: this event is fired when a user clicks on a node
34 <div id="tree1"></div>
39 <div id="tree1" data-url="/nodes/"></div>
46 var $tree = $('#tree1');
48 data: ExampleData.example_data,
54 // Disable single selection
57 var selected_node = e.node;
59 if (selected_node.id == undefined) {
60 console.log('The multiple selection functions require that nodes have an id');
63 if ($tree.tree('isNodeSelected', selected_node)) {
64 $tree.tree('removeFromSelection', selected_node);
67 $tree.tree('addToSelection', selected_node);