This time I will share jQuery Plugin and tutorial about Create A CRUD Tree Table With jQuery And Bootstrap – edittreetable, hope it will help you in programming stack.
edittreetable is a jQuery plugin used for rendering a hierarchical CRUD tree table from JSON objects using Bootstrap styles.
Features:
- Allows to add/remove/update as many nodes as you prefer.
- Delete confirmation.
- Collapsible and expandable.
Basic usage:
1. Download and include the jQuery edittreetable plugin into your project which has jQuery and Bootstrap included.
1 |
< script src = "jquery.edittreetable.js" ></ script > |
2. Include the Font Awesome 4 for icons.
1 |
< link rel = "stylesheet" href = "/path/to/font-awesome.min.css" > |
3. Add nodes to the tree table as follows:
02 |
id:1,name: "JavaScript" ,pid:0 |
05 |
id:2,name: "jQuery" ,pid:1 |
08 |
id:6,name: "ReactJS" ,pid:1 |
11 |
id:4,name: "AngularJS" ,pid:1 |
14 |
id:5,name: "Zepto" ,pid:1 |
4. Render a basic tree table in the webpage.
01 |
$( "#container).bstreetable({ |
03 |
maintitle:" languages", |
04 |
nodeaddCallback: function (data,callback){ |
05 |
alert(JSON.stringify(data)); |
07 |
callback({id:18,name:data.name,pid:data.pid}); |
09 |
noderemoveCallback: function (data,callback){ |
10 |
alert(JSON.stringify(data)); |
14 |
nodeupdateCallback: function (data,callback){ |
15 |
alert(JSON.stringify(data)); |
5. Plugin’s default options and callbacks.
01 |
$( "#container).bstreetable({ |
07 |
nodeaddCallback:function(data,callback){}, |
08 |
noderemoveCallback:function(data,callback){}, |
09 |
nodeupdateCallback:function(data,callback){}, |
10 |
customalert:function(msg){ |
13 |
customconfirm:function(msg){ |
17 |
NodeDeleteText:" Are You Sure To Delete This Node?" |
This awesome jQuery plugin is developed by songhlc. For more Advanced Usages, please check the demo page or visit the official website.