Getting Started with ExtJS tree controls

Source: Internet
Author: User

The ExtJS tree control is defined by the Ext.tree.TreePanel class, and the control's name is Treepanel,treepanel inherited from the Panel class, and using a tree control in ExtJS is actually simple.

You know that to use ExtJS must introduce his library, so we are going to introduce the following several files:

Ext-all.css

Ext-base.js

Ext-all.js

PS: I am using the extjs3.0 version

How do I load the plugin? Rest assured, ExtJS has its own method of loading:

Ext.onready (function () {

Coding ...

}

The following is the instance code:

Tree control        var root = new Ext.tree.TreeNode ({            id: ' Root ',            text: "Root of Tree"        });        var root2=root.appendchild (New Ext.tree.TreeNode ({            ID: "C1",            text: "First layer"        }));        Root2.appendchild (New Ext.tree.TreeNode ({            ID: "C3",            Text: "2nd"        });        Root.appendchild ({            ID: "C2",            text: "First layer 2"        });        var tree=new Ext.tree.TreePanel ({            renderTo:Ext.getBody (),            root:root,            width:100        });
View Code

This example is a three-tier structure, in which we can set the position of the node according to the level of the node.

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.