[Reprinted] ext core API details Ext. Data (13th)-tree/node

Source: Internet
Author: User
Ext. Data. Tree
Inherited from observable, used to store the data structure of the tree

Method
Tree ([node root])
Use root as the root to construct the Ext. Data. Tree object

Getnodebyid (string ID): Node
Get the node by the specified ID

Getrootnode (): Node
Get the root node, which is more convenient to get from the property Root

Setrootnode (node): Node
Set the root node

The event has
Append: (TREE tree, node parent, node, number index)
Beforeappend: (TREE tree, node parent, node)
Beforeinsert: (TREE tree, node parent, node, node refnode)
Beforemove: (TREE tree, node, node oldparent, node newparent, number index)
Beforeremove: (TREE tree, node parent, node)
Insert: (TREE tree, node parent, node, node refnode)
Move: (TREE tree, node, node oldparent, node newparent, number index)
Remove: (TREE tree, node parent, node)


Ext. Data. Node
Node
Attribute
Attributes: Object
Node Attribute Set

Childnodes: Array
Subnode

Firstchild: Node
First subnode

ID: String
ID

Lastchild: Node
Last subnode

Nextsibling: Node
Next sibling Node

Parentnode: Node
Parent node

Previussibling: Node
Previous sibling Node

Node (Object Attributes)
Construct a node

Appendchild (node/array node): Node
Attach the node as the lastchild of the current node

Bubble (function FN, [object scope], [array ARGs]): void
From the current node to the root node, apply FN to each node until a FN returns false.

Cascade (function FN, [object scope], [array ARGs]): void
Apply FN to each child node from the current node until false is returned.

Contains (node): Boolean
Is the current node an ancestor node of a node?

Eachchild (function FN, [object scope], [array ARGs]): void
Basically the same as cascade, but only apply FN to sub-nodes

Findchild (string attribute, mixed value): Node
Find the first node with the attribute value of value in the subnode.

Findchildby (function FN, [object scope]): Node
Find the first application FN return real node in the subnode

Getdepth (): Number
Obtain the depth of the current node. The root node depth is 0.

Getownertree (): Tree
Get the tree object of the current node

Getpath ([String ATTR]): String
Obtain the path of the current node. The default value is ATTR.

Indexof (node): Number
Node position in the subnode of the current node

Insertbefore (node, node refnode): Node
Insert a node before the reference node refnode

Isancestor (node): Boolean
Is the current node an ancestor node of a node?

Isfirst (): Boolean
Islast (): Boolean
The current node is the first or last node of the parent node.

Isleaf (): Boolean
Is it a leaf node? Does not include subnodes

Item (number index): Node
Subnode of Index

Removechild (node): Node
Remove node subnodes

ReplaceChild (node newchild, node oldchild): Node
Replace oldchild with newchild

Sort (function FN, [object scope]): void
Sorts subnodes with the specified FN

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.