diff options
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/jqTree/static/examples/multiple_select.js')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/jqTree/static/examples/multiple_select.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ecomp-portal-FE/client/bower_components/jqTree/static/examples/multiple_select.js b/ecomp-portal-FE/client/bower_components/jqTree/static/examples/multiple_select.js new file mode 100644 index 00000000..54ab18f3 --- /dev/null +++ b/ecomp-portal-FE/client/bower_components/jqTree/static/examples/multiple_select.js @@ -0,0 +1,27 @@ +$(function() { + var $tree = $('#tree1'); + $tree.tree({ + data: ExampleData.example_data, + autoOpen: true + }); + $tree.bind( + 'tree.click', + function(e) { + // Disable single selection + e.preventDefault(); + + var selected_node = e.node; + + if (selected_node.id == undefined) { + console.log('The multiple selection functions require that nodes have an id'); + } + + if ($tree.tree('isNodeSelected', selected_node)) { + $tree.tree('removeFromSelection', selected_node); + } + else { + $tree.tree('addToSelection', selected_node); + } + } + ); +}); |