This time I will share jQuery Plugin and tutorial about Dynamic Tree View Plugin With jQuery And Bootstrap, hope it will help you in programming stack.
A jQuery treeview plugin that helps you render a dynamic, checkable, filterable, collapsible, vertical hierarchical tree from a JSON schema. Licensed under the Apache License, Version 2.0.
How to use it:
1. Make sure you first have jQuery library and Twitter Bootstrap‘s stylesheet are loaded in the document.
1 |
< link rel = "stylesheet" href = "bootstrap.min.css" > |
2 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2. Load the jQuery Bootstrap tree view plugin’s files in the document.
1 |
< link rel = "stylesheet" href = "bootstrap-treeview.css" > |
2 |
< script src = "bootstrap-treeview.js" ></ script > |
3. Create a placeholder element for the tree view.
1 |
< div id = "default-tree" ></ div > |
4. The required JSON structure to hold your hierarchical data.
5. Render a default tree view inside the DIV container you just created.
1 |
$( '#default-tree' ).treeview({ |
6. All customization options for the tree view.
01 |
$( '#default-tree' ).treeview({ |
07 |
expandIcon: 'glyphicon glyphicon-plus' , |
08 |
collapseIcon: 'glyphicon glyphicon-minus' , |
09 |
emptyIcon: 'glyphicon' , |
12 |
checkedIcon: 'glyphicon glyphicon-check' , |
13 |
uncheckedIcon: 'glyphicon glyphicon-unchecked' , |
18 |
borderColor: undefined, |
19 |
onhoverColor: '#F5F5F5' , |
20 |
selectedColor: '#FFFFFF' , |
21 |
selectedBackColor: '#428bca' , |
22 |
searchResultColor: '#D9534F' , |
23 |
searchResultBackColor: undefined, |
29 |
highlightSelected: true , |
32 |
highlightSearchResults: true , |
7. Event handlers available.
01 |
$( '#default-tree' ).treeview({ |
03 |
onNodeChecked: undefined, |
04 |
onNodeCollapsed: undefined, |
05 |
onNodeDisabled: undefined, |
06 |
onNodeEnabled: undefined, |
07 |
onNodeExpanded: undefined, |
08 |
onNodeSelected: undefined, |
09 |
onNodeUnchecked: undefined, |
10 |
onNodeUnselected: undefined, |
11 |
onSearchComplete: undefined, |
12 |
onSearchCleared: undefined |
8. All available methods.
02 |
$( '#default-tree' ).treeview( 'checkAll' , { silent: true }); |
05 |
$( '#default-tree' ).treeview( 'checkNode' , [ nodeId, { silent: true } ]); |
08 |
$( '#default-tree' ).treeview( 'clearSearch' ); |
11 |
$( '#default-tree' ).treeview
source : jqueryscript.net
|