| Package: | Ext.tree |
| Class: | DefaultSelectionModel |
| Extends: | Observable |
| Defined In: | TreeSelectionModel.js |
| Method | Defined By | |
|---|---|---|
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 | ||
| clearSelections() : void | DefaultSelectionModel | |
| Clear all selections | ||
fireEvent(String eventName, Object... args) : Boolean |
Observable | |
| Fires the specified event with the passed parameters (minus the event name). | ||
| getSelectedNode() : TreeNode | DefaultSelectionModel | |
| Get the selected node | ||
hasListener(String eventName) : Boolean |
Observable | |
| Checks to see if this object is currently listening for a specified event | ||
isSelected(TreeNode node) : Boolean |
DefaultSelectionModel | |
| Returns true if the node is selected | ||
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 | ||
select(TreeNode node) : TreeNode |
DefaultSelectionModel | |
| Select a node. | ||
| selectNext() : TreeNode | DefaultSelectionModel | |
| Selects the node above the selected node in the tree, intelligently walking the nodes | ||
| selectPrevious() : TreeNode | DefaultSelectionModel | |
| Selects the node above the selected node in the tree, intelligently walking the nodes | ||
un(String eventName, Function handler, [Object scope]) : void |
Observable | |
| Removes a listener (shorthand for removeListener) | ||
unselect(TreeNode node) : void |
DefaultSelectionModel | |
| Deselect a node. | ||
| Event | Defined By | |
|---|---|---|
beforeselect : (DefaultSelectionModel this, TreeNode node, TreeNode node) |
DefaultSelectionModel | |
| Fires before the selected node changes, return false to cancel the change | ||
selectionchange : (DefaultSelectionModel this, TreeNode node) |
DefaultSelectionModel | |
| Fires when the selected node changes | ||
public function addEvents(Object object)
object : Objectvoidpublic 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 });voidpublic function clearSelections()
voidpublic function fireEvent(String eventName, Object... args)
eventName : Stringargs : Object...Booleanpublic function getSelectedNode()
TreeNodepublic function hasListener(String eventName)
eventName : StringBooleanpublic function isSelected(TreeNode node)
node : TreeNodeBooleanpublic function on(String eventName, Function handler, [Object options])
eventName : Stringhandler : Functionoptions : Objectvoidpublic function purgeListeners()
voidpublic function removeListener(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic function select(TreeNode node)
node : TreeNodeTreeNodepublic function selectNext()
TreeNodepublic function selectPrevious()
TreeNodepublic function un(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic function unselect(TreeNode node)
node : TreeNodevoidpublic event beforeselect
this : DefaultSelectionModelnode : TreeNodenode : TreeNodepublic event selectionchange
this : DefaultSelectionModelnode : TreeNode