EXT核心API详解(十二)_Ext.data.Tree/Ext.data.Node

[size=small][color=red][b]Ext.data.Tree[/b][/color]
继承自Observable,用于存放树装的数据结构
[color=red]方法[/color]
[b]Tree( [Node root] )[/b]
以root为根构造Ext.data.Tree对象
[b]getNodeById( String id ) : Node[/b]
由指定id得到节点
[b]getRootNode() : Node[/b]
得到根节点,由属性root得到更方便
[b]setRootNode( Node node ) : Node[/b]
设置根节点
[color=red]事件[/color]有
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 )

[color=red][b]Ext.data.Node[/b][/color]
节点
[color=red]属性[/color]
[b]attributes : Object[/b]
节点属性集
[b]childNodes : Array[/b]
子节点
[b]firstChild : Node[/b]
第一个子节点
[b]id : String[/b]
id
[b]lastChild : Node[/b]
最后一个子节点
[b]nextSibling : Node[/b]
下一个兄弟节点
[b]parentNode : Node[/b]
父节点
[b]previousSibling : Node[/b]
前一个兄弟节点
[b]Node( Object attributes )[/b]
[color=red]构造节点[/color]
[b]appendChild( Node/Array node ) : Node[/b]
将node做为附加在当前节点的lastChild之后
[b]bubble( Function fn, [Object scope], [Array args] ) : void[/b]
由当前节点开始一直上溯到根节点,对于每个节点应用fn,直到有一个fn返回假为止
[b]cascade( Function fn, [Object scope], [Array args] ) : void[/b]
由当前节点开始一下对每个[color=red]子孙节点[/color]应用fn.直到返回false为止
[u][b]contains( Node node ) : Boolean[/[/u]b]
当前节点是node的祖先节点?
[b]eachChild( Function fn, [Object scope], [Array args] ) : void[/b]
基本同cascade,但只针对[color=red]子节点[/color]应用fn
[b]findChild( String attribute, Mixed value ) : Node[/b]
在子节点中找到[color=red]第一个[/color]有属性attribute值为value的节点
[b]findChildBy( Function fn, [Object scope] ) : Node[/b]
在子节点中找到[color=red]第一个应用fn返回真[/color]的节点
[b]getDepth() : Number[/b]
得到当前节点深度,根节点深度为0
[b]getOwnerTree() : Tree[/b]
得到当前节点的Tree对象
[b]getPath( [String attr] ) : String[/b]
得到当前节点的路径,默认attr为id
[b]indexOf( Node node ) : Number[/b]
node在当前节点的子节点中的位置
[b]insertBefore( Node node, Node refNode ) : Node[/b]
在参考节点refNode之前插入node节点
[u][b]isAncestor( Node node ) : Boolean[/b][/u]
当前节点是node的祖先节点?
[b]isFirst() : Boolean
isLast() : Boolean[/b]
当前节点是父节点的第一/最后一个节点
[b]isLeaf() : Boolean[/b]
是叶节点?指不含子节点
[b]item( Number index ) : Node[/b]
第index个子节点
[b]removeChild( Node node ) : Node[/b]
移除node子节点
[b]replaceChild( Node newChild, Node oldChild ) : Node[/b]
用newchild替换oldchild子节点
[b]sort( Function fn, [Object scope] ) : void[/b]
用指定的fn排序子节点[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值