| Package: | Ext.tree |
| Class: | TreeLoader |
| Extends: | Observable |
| Defined In: | TreeLoader.js |
[{ 'id': 1, 'text': 'A folder Node', 'leaf': false },
{ 'id': 2, 'text': 'A leaf Node', 'leaf': true }]
myTreeLoader.on("beforeload", function(treeLoader, node) {
this.baseParams.category = node.attributes.category;
}, this);
<
This would pass an HTTP parameter called "category" to the server containing
the value of the Node's "category" attribute. | Method | Defined By | |
|---|---|---|
TreeLoader(Object config) |
TreeLoader | |
| Creates a new Treeloader. | ||
addEvents(Object object) : void |
Observable | |
| Used to define events on this Observable | ||
addListener(String eventName, Function handler, [Object scope], [Object options]) : void |
Observable | |
| Appends an event handler to this component | ||
| createNode() : void | TreeLoader | |
| Override this function for custom TreeNode node implementation | ||
fireEvent(String eventName, Object... args) : Boolean |
Observable | |
| Fires the specified event with the passed parameters (minus the event name). | ||
hasListener(String eventName) : Boolean |
Observable | |
| Checks to see if this object has any listeners for a specified event | ||
| load() : void | TreeLoader | |
| Load an Ext.tree.TreeNode from the URL specified in the constructor. This is called automatically when a node is expa... | ||
on(String eventName, Function handler, [Object scope], [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 | ||
un(String eventName, Function handler, [Object scope]) : void |
Observable | |
| Removes a listener (shorthand for removeListener) | ||
| Event | Defined By | |
|---|---|---|
beforeload : (Object This, Object node, Object callback) |
TreeLoader | |
| Fires before a network request is made to retrieve the Json text which specifies a node's children. | ||
load : (Object This, Object node, Object response) |
TreeLoader | |
| Fires when the node has been successfuly loaded. | ||
loadexception : (Object This, Object node, Object response) |
TreeLoader | |
| Fires if the network request failed. | ||
| Config Options | Defined By | |
|---|---|---|
| baseParams : Object | TreeLoader | |
| (optional) An object containing properties which specify HTTP parameters to be passed to each request for child nodes. | ||
| clearOnLoad : Boolean | TreeLoader | |
| (optional) Default to true. Remove previously existing child nodes before loading. | ||
| dataUrl : String | TreeLoader | |
| The URL from which to request a Json string which specifies an array of node definition object representing the child... | ||
| uiProviders : Object | TreeLoader | |
| (optional) An object containing properties which specify custom Ext.tree.TreeNodeUI implementations. If the optional ... | ||
public function TreeLoader(Object config)
config : Objectpublic 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, forumId: 4 }); Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
Code:
foo.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:
foo.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });voidpublic function createNode()
voidpublic function fireEvent(String eventName, Object... args)
eventName : Stringargs : Object...Booleanpublic function hasListener(String eventName)
eventName : StringBooleanpublic function load()
voidpublic function on(String eventName, Function handler, [Object scope], [Object options])
eventName : Stringhandler : Functionscope : Objectoptions : Objectvoidpublic function purgeListeners()
voidpublic function removeListener(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic function un(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic event beforeload
This : Objectnode : Objectcallback : Objectpublic event load
This : Objectnode : Objectresponse : Objectpublic event loadexception
This : Objectnode : Objectresponse : ObjectbaseParams : Object
clearOnLoad : Boolean
dataUrl : String
uiProviders : Object