The tree Table of jquery

Source: Internet
Author: User

Because of the project needs, you need to add a tree to the table, using the jquery tree table, the table is beautifully compatible with various frameworks;

Please download the tree table JS files and CSS files, etc., http://ludo.cubicphuse.nl/jquery-treetable/;

Use the CSS file: <link rel= "stylesheet" href= ". /.. /style/jquery.treetable.css ">

<link rel= "stylesheet" href= ". /.. /style/jquery.treetable.theme.default.css ">

Use the JS file: <script src= ". /.. /js/jquery-1.10.1.min.js "></script>

<script src= ". /.. /js/bootstrap-treeview.min.js "></script>

Examples of Use:

<table id= "TableId" >  <tr data-tt-id= "1" >    <td>Parent</td>  </tr>  <tr data-tt-id= "2" data-tt-parent-id= "1" >    <td>Child</td>  </tr></table>   
The Data-tt-id is 2 tr  through data-tt-parent-id points to 1 nodes, meaning that the second TR is the child node of the first TR;

One line JS done,
$ ("#tableId). treetable ({expandable:true});

Hierarchy of complex tables through the background recursive query to find the data list, you can determine whether the node has a parent node to add parent_id to TR, see example:

var Trarr = $ ("#tableId tr");

for (var i = 0; i < trarr.length; i++) {
$ ("#tableId tr:eq (" + i + ")"). attr (
"Data-tt-id", Tabledate[i].orgid);
if (tabledate[i].parentorg! = ") {
$ ("#tableIdtr: eq (" + i + ")"). attr (
"Data-tt-parent-id", tabledate[i].parentorg);
}
}



The tree Table of jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.