Package: | Ext.data |
Class: | Tree |
Extends: | Observable |
Subclasses: | TreePanel |
Defined In: | Tree.js |
属性 | 定义对象 | |
---|---|---|
root : Node | Tree | |
The root node for this tree |
方法 | 定义对象 | |
---|---|---|
Tree([Node root ]) |
Tree | |
addEvents(Object object ) : void |
Observable | |
将对象中没有的事件从给出的对象中复制过来。 | ||
addListener(String eventName , Function handler , [Object scope ], [Object options ]) : void |
Observable | |
为该组件加入事件处理器函数 | ||
fireEvent(String eventName , Object... args ) : Boolean |
Observable | |
触发指定的事件, 并将参数传入(至少要有事件名称)。 | ||
getNodeById(String id ) : Node |
Tree | |
Gets a node in this tree by its id | ||
getRootNode() : Node | Tree | |
Returns this root node for this tree | ||
hasListener(String eventName ) : Boolean |
Observable | |
检查该对象是否拥有指定事件的侦听器 | ||
on(String eventName , Function handler , [Object options ]) : void |
Observable | |
为该组件加入事件处理器函数, addListener 的简写方式 | ||
purgeListeners() : void | Observable | |
从对象身上移除所有的侦听器 | ||
removeListener(String eventName , Function handler , [Object scope ]) : void |
Observable | |
移除侦听器 | ||
setRootNode(Node node ) : Node |
Tree | |
Sets the root node for this tree | ||
un(String eventName , Function handler , [Object scope ]) : void |
Observable | |
移除侦听器, removeListener 的简写方式 |
事件 | 定义对象 | |
---|---|---|
append : (Tree tree , Node parent , Node node , Number index ) |
Tree | |
Fires when a new child node is appended to a node in this tree. | ||
beforeappend : (Tree tree , Node parent , Node node ) |
Tree | |
Fires before a new child is appended to a node in this tree, return false to cancel the append. | ||
beforeinsert : (Tree tree , Node parent , Node node , Node refNode ) |
Tree | |
Fires before a new child is inserted in a node in this tree, return false to cancel the insert. | ||
beforemove : (Tree tree , Node node , Node oldParent , Node newParent , Number index ) |
Tree | |
Fires before a node is moved to a new location in the tree. Return false to cancel the move. | ||
beforeremove : (Tree tree , Node parent , Node node ) |
Tree | |
Fires before a child is removed from a node in this tree, return false to cancel the remove. | ||
insert : (Tree tree , Node parent , Node node , Node refNode ) |
Tree | |
Fires when a new child node is inserted in a node in this tree. | ||
move : (Tree tree , Node node , Node oldParent , Node newParent , Number index ) |
Tree | |
Fires when a node is moved to a new location in the tree | ||
remove : (Tree tree , Node parent , Node node ) |
Tree | |
Fires when a child node is removed from a node in this tree. |
public function Tree([Node root
])
root
: Nodepublic function addEvents(Object object
)
object
: Objectvoid
public function addListener(String eventName
, Function handler
, [Object scope
], [Object options
])
eventName
: Stringhandler
: Functionscope
: Objectoptions
: Object
组合选项
使用选项参数可以组合不同类型的监听器:
下面是一个标准的、延迟执行的、一次性的监听器,将会自动停止事件并传递一个自定义的参数(forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });
这个方法也允许传递的单个参数是一个包含多个指定处理函数的设置对象。
一次调用多个处理函数
代码:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } });
或者简写为:
代码:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });
void
public function fireEvent(String eventName
, Object... args
)
eventName
: Stringargs
: Object...Boolean
public function getNodeById(String id
)
id
: StringNode
public function getRootNode()
Node
public function hasListener(String eventName
)
eventName
: StringBoolean
public function on(String eventName
, Function handler
, [Object options
])
eventName
: Stringhandler
: Functionoptions
: Objectvoid
public function purgeListeners()
void
public function removeListener(String eventName
, Function handler
, [Object scope
])
eventName
: Stringhandler
: Functionscope
: Objectvoid
public function setRootNode(Node node
)
node
: NodeNode
public function un(String eventName
, Function handler
, [Object scope
])
eventName
: Stringhandler
: Functionscope
: Objectvoid
public event append
tree
: Treeparent
: Nodenode
: Nodeindex
: Numberpublic event beforeappend
tree
: Treeparent
: Nodenode
: Nodepublic event beforeinsert
tree
: Treeparent
: Nodenode
: NoderefNode
: Nodepublic event beforemove
tree
: Treenode
: NodeoldParent
: NodenewParent
: Nodeindex
: Numberpublic event beforeremove
tree
: Treeparent
: Nodenode
: Nodepublic event insert
tree
: Treeparent
: Nodenode
: NoderefNode
: Nodepublic event move
tree
: Treenode
: NodeoldParent
: NodenewParent
: Nodeindex
: Numberpublic event remove
tree
: Treeparent
: Nodenode
: Node