Package: | Ext.data |
Class: | Tree |
Extends: | Observable |
Subclasses: | TreePanel |
Defined In: | Tree.js |
Property | Defined By | |
---|---|---|
root : Node | Tree | |
The root node for this tree |
Method | Defined By | |
---|---|---|
Tree([Node root ]) |
Tree | |
addEvents(Object object ) : void |
Observable | |
Copies any events from the passed object onto this object if they do not already exist. The passed object must also ... | ||
addListener(String eventName , Function handler , [Object scope ], [Object options ]) : void |
Observable | |
Appends an event handler to this component | ||
fireEvent(String eventName , Object... args ) : Boolean |
Observable | |
Fires the specified event with the passed parameters (minus the event name). | ||
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 | |
Checks to see if this object is currently listening for a specified event | ||
on(String eventName , Function handler , [Object options ]) : void |
Observable | |
Appends an event handler to this element (shorthand for addListener) | ||
purgeListeners() : void | Observable | |
Removes all listeners for this object | ||
removeListener(String eventName , Function handler , [Object scope ]) : void |
Observable | |
Removes a listener | ||
setRootNode(Node node ) : Node |
Tree | |
Sets the root node for this tree | ||
un(String eventName , Function handler , [Object scope ]) : void |
Observable | |
Removes a listener (shorthand for removeListener) |
Event | Defined By | |
---|---|---|
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 Combining Options
Using the options argument, it is possible to combine different types of listeners:
A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
Attaching multiple handlers in 1 call
Code:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } });
Or a shorthand syntax:
Code:
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