Ext.data-Tree/Node

來源:互聯網
上載者:User
Ext.data.Tree
繼承自Observable,用於存放樹裝的資料結構

方法
Tree( [Node root] )
以root為根構造Ext.data.Tree對象

getNodeById( String id ) : Node
由指定id得到節點

getRootNode() : Node
得到根節點,由屬性root得到更方便

setRootNode( Node node ) : Node
設定根節點

事件有
append : ( Tree tree, Node parent, Node node, Number index )
beforeappend : ( Tree tree, Node parent, Node node )
beforeinsert : ( Tree tree, Node parent, Node node, Node refNode )
beforemove : ( Tree tree, Node node, Node oldParent, Node newParent, Number index )
beforeremove : ( Tree tree, Node parent, Node node )
insert : ( Tree tree, Node parent, Node node, Node refNode )
move : ( Tree tree, Node node, Node oldParent, Node newParent, Number index )
remove : ( Tree tree, Node parent, Node node )


Ext.data.Node
節點
屬性
attributes : Object
節點屬性集

childNodes : Array
子節點

firstChild : Node
第一個子節點

id : String
id

lastChild : Node
最後一個子節點

nextSibling : Node
下一個兄弟節點

parentNode : Node
父節點

previousSibling : Node
前一個兄弟節點

Node( Object attributes )
構造節點

appendChild( Node/Array node ) : Node
將node做為附加在當前節點的lastChild之後

bubble( Function fn, [Object scope], [Array args] ) : void
由當前節點開始一直上溯到根節點,對於每個節點應用fn,直到有一個fn返回假為止

cascade( Function fn, [Object scope], [Array args] ) : void
由當前節點開始一下對每個子孫節點應用fn.直到返回false為止

contains( Node node ) : Boolean
當前節點是node的祖先節點?

eachChild( Function fn, [Object scope], [Array args] ) : void
基本同cascade,但只針對子節點應用fn

findChild( String attribute, Mixed value ) : Node
在子節點中找到第一個有屬性attribute值為value的節點

findChildBy( Function fn, [Object scope] ) : Node
在子節點中找到第一個應用fn返回真的節點

getDepth() : Number
得到當前節點深度,根節點深度為0

getOwnerTree() : Tree
得到當前節點的Tree對象

getPath( [String attr] ) : String
得到當前節點的路徑,預設attr為id

indexOf( Node node ) : Number
node在當前節點的子節點中的位置

insertBefore( Node node, Node refNode ) : Node
在參考節點refNode之前插入node節點

isAncestor( Node node ) : Boolean
當前節點是node的祖先節點?

isFirst() : Boolean
isLast() : Boolean
當前節點是父節點的第一/最後一個節點

isLeaf() : Boolean
是分葉節點?指不含子節點

item( Number index ) : Node
第index個子節點

removeChild( Node node ) : Node
移除node子節點

replaceChild( Node newChild, Node oldChild ) : Node
用newchild替換oldchild子節點

sort( Function fn, [Object scope] ) : void
用指定的fn排序子節點

事件略

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.