Ext.data.TreeStore
Hierarchy
Ext.BaseExt.data.AbstractStoreExt.data.TreeStoreInherited mixins
Requires
Files
The TreeStore is a store implementation that is backed by by an Ext.data.Tree. It provides convenience methods for loading nodes, as well as the ability to use the hierarchical tree structure combined with a store. This class is generally used in conjunction with Ext.tree.Panel. This class also relays many events from the Tree for convenience.
Using Models
If no Model is specified, an implicit model will be created that implements Ext.data.NodeInterface. The standard Tree fields will also be copied onto the Model for maintaining their state. These fields are listed in the Ext.data.NodeInterface documentation.
Reading Nested Data
For the tree to read nested data, the Ext.data.reader.Reader must be configured with a root property, so the reader can find nested data for each node. If a root is not specified, it will default to 'children'.
Available since: 4.0.0
Config options
If data is not specified, and if autoLoad is true or an Object, this store's load method is automatically called after creation. If the value of autoLoad is an Object, this Object will be passed to the store's load method.
Defaults to: false
Available since: Ext 2
True to automatically sync the Store with its Proxy after every edit to one of its Records. Defaults to false.
Defaults to: false
Available since: 4.0.0
Remove previously existing child nodes before loading. Default to true.
Defaults to: true
Available since: 4.0.0
The default root id. Defaults to 'root'
Defaults to: 'root'
Available since: 4.0.0
The root property to specify on the reader if one is not explicitly defined.
Defaults to: 'children'
Available since: 4.0.0
This may be used in place of specifying a model configuration. The fields should be a set of Ext.data.Field configuration objects. The store will automatically create a Ext.data.Model with these fields. In general this configuration option should be avoided, it exists for the purposes of backwards compatibility. For anything more complicated, such as specifying a particular id property or assocations, a Ext.data.Model should be defined and specified for the model config.
Available since: Ext 2
Set to true to automatically prepend a leaf sorter. Defaults to undefined.
Defaults to: false
Available since: 4.0.0
A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.
DOM events from Ext JS Components
While some Ext JS Component classes export selected DOM events (e.g. "click", "mouseover" etc), this is usually
only done when extra value can be added. For example the DataView's itemclick event passing the node clicked on. To access DOM events directly from a
child element of a Component, we need to specify the element option to identify the Component property to add a
DOM listener to:
new Ext.panel.Panel({
width: 400,
height: 200,
dockedItems: [{
xtype: 'toolbar'
}],
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ console.log('click el'); }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){ console.log('dblclick body'); }
}
}
});
Available since: 1.1.0
Name of the Model associated with this store. The string is used as an argument for Ext.ModelManager.getModel.
Available since: 4.0.4
The name of the parameter sent to the server which contains the identifier of the node. Defaults to 'node'.
Defaults to: 'node'
Available since: 4.0.0
The Proxy to use for this Store. This can be either a string, a config object or a Proxy instance - see setProxy for details.
Available since: Ext 1
The root node for this store. For example:
root: {
expanded: true,
text: "My Root",
children: [
{ text: "Child 1", leaf: true },
{ text: "Child 2", expanded: true, children: [
{ text: "GrandChild", leaf: true }
] }
]
}
Setting the root config option is the same as calling setRootNode.
Available since: 4.0.2
Unique identifier for this store. If present, this Store will be registered with the Ext.data.StoreManager, making it easy to reuse elsewhere. Defaults to undefined.
Available since: 4.0.0
Properties
Sets the updating behavior based on batch synchronization. 'operation' (the default) will update the Store's internal representation of the data after each operation of the batch has completed, 'complete' will wait until the entire batch has been completed before updating the Store's data. 'complete' is a good choice for local storage proxies, 'operation' is better for remote proxies, where there is a comparatively high latency.
Defaults to: 'operation'
Available since: 4.0.0
The string type of the Proxy to create if none is specified. This defaults to creating a memory proxy.
Defaults to: 'memory'
Available since: 4.0.0
The default sort direction to use if one is not specified.
Defaults to: "ASC"
Available since: 4.0.0
Defaults to: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|element|vertical|horizontal|freezeEvent)$/
Available since: 4.0.0
If we have no fields declare for the store, add some defaults. These will be ignored if a model is explicitly specified.
Available since: 4.0.0
If true, any filters attached to this Store will be run after loading data, before the datachanged event is fired. Defaults to true, ignored if remoteFilter is true
Defaults to: true
Available since: 4.0.0
True if a model was created implicitly for this Store. This happens if a fields array is passed to the Store's constructor instead of a model constructor or name.
Defaults to: false
Available since: 4.0.0
True if the Store has already been destroyed. If this is true, the reference to Store should be deleted as it will not function correctly any more.
Defaults to: false
Available since: Ext 3
Flag denoting that this object is sortable. Always true.
Defaults to: true
Available since: 4.0.0
A set of default values to be applied to every model instance added via insert or created via create. This is used internally by associations to set foreign keys and other fields. See the Association classes source code for examples. This should not need to be used by application developers.
Available since: 4.0.0
Temporary cache in which removed model instances are kept until successfully synchronised with a Proxy, at which point this is cleared.
Available since: 4.0.0
Get the reference to the current class from which this object was instantiated. Unlike statics,
this.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics
for a detailed comparison
Ext.define('My.Cat', {
statics: {
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
alert(this.self.speciesName); / dependent on 'this'
return this;
},
clone: function() {
return new this.self();
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
}
});
var cat = new My.Cat(); // alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
Available since: 4.0.0
If true, any sorters attached to this Store will be run after loading data, before the datachanged event is fired. Defaults to true, igored if remoteSort is true
Defaults to: true
Available since: 4.0.0
The property in each item that contains the data to sort.
The property in each item that contains the data to sort.
Available since: 4.0.0
Methods
Instance Methods ...
Available since: 4.0.0
Parameters
- config : Object
Returns
Overrides: Ext.data.AbstractStore.constructor
addEvents( o, [more] )Adds the specified events to the list of events which this Observable may fire. ...Adds the specified events to the list of events which this Observable may fire.
Available since: 1.1.0
Parameters
- o : Object/String
Either an object with event names as properties with a value of true or the first
event name string if multiple event names are being passed as separate parameters. Usage:
this.addEvents({
storeloaded: true,
storecleared: true
});
- more : String... (optional)
Additional event names if multiple event names are being passed as separate
parameters. Usage:
this.addEvents('storeloaded', 'storecleared');
addListener( eventName, fn, [scope], [options] )Appends an event handler to this object. ...Appends an event handler to this object.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to listen for. May also be an object who's property names are
event names.
- fn : Function
The method the event invokes. Will be called with arguments given to
fireEvent plus the options parameter described below.
- scope : Object (optional)
The scope (this reference) in which the handler function is executed. If
omitted, defaults to the object which fired the event.
- options : Object (optional)
An object containing handler configuration.
Note: Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.
This object may contain any of the following properties:
scope : Object
The scope (this reference) in which the handler function is executed. If omitted, defaults to the object
which fired the event.
delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of
milliseconds. If the event fires again within that time, the original handler is not invoked, but the new
handler is scheduled in its place.
target : Observable
Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a
child Observable.
element : String
This option is only valid for listeners bound to Components. The name of a Component
property which references an element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of
Components which will exist only after the Component is rendered.
For example, to add a click listener to a Panel's body:
new Ext.panel.Panel({
title: 'The title',
listeners: {
click: this.handlePanelClick,
element: 'body'
}
});
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener.
myPanel.on('hide', this.handleClick, this, {
single: true,
delay: 100
});
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 events. For example:
myGridPanel.on({
cellClick: this.onCellClick,
mouseover: this.onMouseOver,
mouseout: this.onMouseOut,
scope: this // Important. Ensure "this" is correct during handler execution
});
One can also specify options for each event handler separately:
myGridPanel.on({
cellClick: {fn: this.onCellClick, scope: this, single: true},
mouseover: {fn: panel.onMouseOver, scope: panel}
});
addManagedListener( item, ename, [fn], [scope], [opt] )Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is
destr...Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is
destroyed.
Available since: 4.0.0
Parameters
- item : Ext.util.Observable/Ext.Element
The item to which to add a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the ename parameter was an event name, this is the handler function.
- scope : Object (optional)
If the ename parameter was an event name, this is the scope (this reference)
in which the handler function is executed.
- opt : Object (optional)
If the ename parameter was an event name, this is the
addListener options.
afterCommit( record )privateA model instance should call this method on the Store it has been joined to. ...A model instance should call this method on the Store it has been joined to.
Available since: Ext 3
Parameters
- record : Ext.data.Model
The model instance that was edited
afterEdit( record )privateA model instance should call this method on the Store it has been joined to. ...A model instance should call this method on the Store it has been joined to.
Available since: Ext 3
Parameters
- record : Ext.data.Model
The model instance that was edited
afterReject( record )privateA model instance should call this method on the Store it has been joined to.. ...A model instance should call this method on the Store it has been joined to..
Available since: Ext 3
Parameters
- record : Ext.data.Model
The model instance that was edited
Call the original method that was previously overridden with override
Ext.define('My.Cat', {
constructor: functi...Call the original method that was previously overridden with override
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
return this;
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callOverridden();
alert("Meeeeoooowwww");
return instance;
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the arguments object
Returns
- Object
Returns the result after calling the overridden method
Call the parent's overridden method. ...Call the parent's overridden method. For example:
Ext.define('My.own.A', {
constructor: function(test) {
alert(test);
}
});
Ext.define('My.own.B', {
extend: 'My.own.A',
constructor: function(test) {
alert(test);
this.callParent([test + 1]);
}
});
Ext.define('My.own.C', {
extend: 'My.own.B',
constructor: function() {
alert("Going to call parent's overriden constructor...");
this.callParent(arguments);
}
});
var a = new My.own.A(1); // alerts '1'
var b = new My.own.B(1); // alerts '1', then alerts '2'
var c = new My.own.C(2); // alerts "Going to call parent's overriden constructor..."
// alerts '2', then alerts '3'
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the arguments object
from the current method, for example: this.callParent(arguments)
Returns
- Object
Returns the result from the superclass' method
Removes all listeners for this object including the managed listeners ...Removes all listeners for this object including the managed listeners
Available since: 4.0.0
Removes all managed listeners for this object. ...Removes all managed listeners for this object.
Available since: 4.0.0
continueFireEvent( eventName, args, bubbles )★private create( data, options )private Normalizes an array of filter objects, ensuring that they are all Ext.util.Filter instances ...Normalizes an array of filter objects, ensuring that they are all Ext.util.Filter instances
Available since: 4.0.0
Parameters
- filters : Object[]
The filters array
Returns
- Ext.util.Filter[]
Array of Ext.util.Filter objects
Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances ...Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances
Available since: 4.0.0
Parameters
- sorters : Object[]
The sorters array
Returns
- Ext.util.Sorter[]
Array of Ext.util.Sorter objects
destroy( options )privatetells the attached proxy to destroy the given records ...tells the attached proxy to destroy the given records
Available since: Ext 3
Parameters
- options : Object
doSort( sorterFn )privateinherit docs ...inherit docs
Available since: 4.0.0
Parameters
- sorterFn : Object
Overrides: Ext.data.AbstractStore.doSort
enableBubble( events )Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if
present. ...Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if
present. There is no implementation in the Observable base class.
This is commonly used by Ext.Components to bubble events to owner Containers.
See Ext.Component.getBubbleTarget. The default implementation in Ext.Component returns the
Component's immediate owner. But if a known target is required, this can be overridden to access the
required target more quickly.
Example:
Ext.override(Ext.form.field.Base, {
// Add functionality to Field's initComponent to enable the change event to bubble
initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {
this.enableBubble('change');
}),
// We know that we want Field's events to bubble directly to the FormPanel.
getBubbleTarget : function() {
if (!this.formPanel) {
this.formPanel = this.findParentByType('form');
}
return this.formPanel;
}
});
var myForm = new Ext.formPanel({
title: 'User Details',
items: [{
...
}],
listeners: {
change: function() {
// Title goes red if form has been modified.
myForm.header.setStyle('color', 'red');
}
}
});
Available since: 3.4.0
Parameters
fillNode( node, records )privateFills a node with a series of child records. ...Fills a node with a series of child records.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node to fill
- records : Ext.data.Model[]
The records to add
filter( filters, value )private Fires the specified event with the passed parameters (minus the event name, plus the options object passed
to addList...Fires the specified event with the passed parameters (minus the event name, plus the options object passed
to addListener).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by
calling enableBubble.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to fire.
- args : Object...
Variable number of parameters are passed to handlers.
Returns
- Boolean
returns false if any of the handlers return false otherwise it returns true.
getBatchListeners( ) : ObjectprivateReturns an object which is passed in as the listeners argument to proxy.batch inside this.sync. ...Returns an object which is passed in as the listeners argument to proxy.batch inside this.sync.
This is broken out into a separate function to allow for customisation of the listeners
Available since: 4.0.0
Returns
- Object
The listeners object
getBubbleParent( ) : Ext.util.Observable★privateGets the bubbling parent for an Observable ...Gets the bubbling parent for an Observable
Available since: Ext JS 4.0.7
Returns
- Ext.util.Observable
The bubble parent. null is returned if no bubble target exists
getNewRecords( ) : Ext.data.Model[]inherit docs
Returns all Model instances that are either currently a phantom (e.g. ...inherit docs
Returns all Model instances that are either currently a phantom (e.g. have no id), or have an ID but have not
yet been saved on this Store (this happens when adding a non-phantom record from another Store into this one)
Available since: 4.0.0
Returns
- Ext.data.Model[]
The Model instances
Overrides: Ext.data.AbstractStore.getNewRecords
Returns the record node by id ... Returns the proxy currently attached to this proxy instance ...Returns the proxy currently attached to this proxy instance
Available since: 4.0.0
Returns
- Ext.data.proxy.Proxy
The Proxy instance
getRemovedRecords( ) : Ext.data.Model[]Returns any records that have been removed from the store but not yet destroyed on the proxy. ...Returns any records that have been removed from the store but not yet destroyed on the proxy.
Available since: 4.0.0
Returns
- Ext.data.Model[]
The removed Model instances
getUpdatedRecords( ) : Ext.data.Model[]inherit docs
Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy ...inherit docs
Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy
Available since: 4.0.0
Returns
- Ext.data.Model[]
The updated Model instances
Overrides: Ext.data.AbstractStore.getUpdatedRecords
Initialize configuration for this class. ...Initialize configuration for this class. a typical example:
Ext.define('My.awesome.Class', {
// The default config
config: {
name: 'Awesome',
isAwesome: true
},
constructor: function(config) {
this.initConfig(config);
return this;
}
});
var awesome = new My.awesome.Class({
name: 'Super Awesome'
});
alert(awesome.getName()); // 'Super Awesome'
Available since: 4.0.0
Parameters
- config : Object
Returns
- Object
mixins The mixin prototypes as key - value pairs
initSortable( )Performs initialization of this mixin. ...Performs initialization of this mixin. Component classes using this mixin should call this method during their
own initialization.
Available since: 4.0.0
Returns true if the Store is currently performing a load operation ...Returns true if the Store is currently performing a load operation
Available since: 4.0.0
Returns
- Boolean
True if the Store is currently loading
load( [options] )Loads the Store using its configured proxy. ...Loads the Store using its configured proxy.
Available since: 4.0.0
Parameters
- options : Object (optional)
config object. This is passed into the Operation
object that is created and then sent to the proxy's Ext.data.proxy.Proxy.read function.
The options can also contain a node, which indicates which node is to be loaded. If not specified, it will
default to the root node.
Overrides: Ext.data.AbstractStore.load
mixin( name, cls )private mon( item, ename, [fn], [scope], [opt] )Shorthand for addManagedListener. ...Shorthand for addManagedListener.
Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is
destroyed.
Available since: 4.0.2
Parameters
- item : Ext.util.Observable/Ext.Element
The item to which to add a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the ename parameter was an event name, this is the handler function.
- scope : Object (optional)
If the ename parameter was an event name, this is the scope (this reference)
in which the handler function is executed.
- opt : Object (optional)
If the ename parameter was an event name, this is the
addListener options.
mun( item, ename, [fn], [scope] )Shorthand for removeManagedListener. ...Shorthand for removeManagedListener.
Removes listeners that were added by the mon method.
Available since: 4.0.2
Parameters
- item : Ext.util.Observable/Ext.Element
The item from which to remove a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the ename parameter was an event name, this is the handler function.
- scope : Object (optional)
If the ename parameter was an event name, this is the scope (this reference)
in which the handler function is executed.
on( eventName, fn, [scope], [options] )Shorthand for addListener. ...Shorthand for addListener.
Appends an event handler to this object.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to listen for. May also be an object who's property names are
event names.
- fn : Function
The method the event invokes. Will be called with arguments given to
fireEvent plus the options parameter described below.
- scope : Object (optional)
The scope (this reference) in which the handler function is executed. If
omitted, defaults to the object which fired the event.
- options : Object (optional)
An object containing handler configuration.
Note: Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.
This object may contain any of the following properties:
scope : Object
The scope (this reference) in which the handler function is executed. If omitted, defaults to the object
which fired the event.
delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of
milliseconds. If the event fires again within that time, the original handler is not invoked, but the new
handler is scheduled in its place.
target : Observable
Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a
child Observable.
element : String
This option is only valid for listeners bound to Components. The name of a Component
property which references an element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of
Components which will exist only after the Component is rendered.
For example, to add a click listener to a Panel's body:
new Ext.panel.Panel({
title: 'The title',
listeners: {
click: this.handlePanelClick,
element: 'body'
}
});
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener.
myPanel.on('hide', this.handleClick, this, {
single: true,
delay: 100
});
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 events. For example:
myGridPanel.on({
cellClick: this.onCellClick,
mouseover: this.onMouseOver,
mouseout: this.onMouseOut,
scope: this // Important. Ensure "this" is correct during handler execution
});
One can also specify options for each event handler separately:
myGridPanel.on({
cellClick: {fn: this.onCellClick, scope: this, single: true},
mouseover: {fn: panel.onMouseOver, scope: panel}
});
onBatchComplete( batch, operation )private onBatchException( batch, operation )private onBatchOperationComplete( batch, operation )private onBeforeNodeCollapse( node, callback, scope )privateCalled before a node is collapsed. ...Called before a node is collapsed.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node being collapsed.
- callback : Function
The function to run after the collapse finishes
- scope : Object
The scope in which to run the callback function
onBeforeNodeExpand( node, callback, scope )privateCalled before a node is expanded. ...Called before a node is expanded.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node being expanded.
- callback : Function
The function to run after the expand finishes
- scope : Object
The scope in which to run the callback function
onCreateRecords( records, operation, success )privateCreates any new records when a write is returned from the server. ...Creates any new records when a write is returned from the server.
Available since: 4.0.0
Parameters
- records : Ext.data.Model[]
The array of new records
- operation : Ext.data.Operation
The operation that just completed
- success : Boolean
True if the operation was successful
onDestroyRecords( records, operation, success )privateRemoves any records when a write is returned from the server. ...Removes any records when a write is returned from the server.
Available since: 4.0.0
Parameters
- records : Ext.data.Model[]
The array of removed records
- operation : Ext.data.Operation
The operation that just completed
- success : Boolean
True if the operation was successful
onNodeAdded( parent, node )private onNodeRemove( parent, node )private onProxyWrite( operation )privateCallback for any write Operation over the Proxy. ...Callback for any write Operation over the Proxy. Updates the Store's MixedCollection to reflect
the updates provided by the Proxy
Available since: 4.0.0
Parameters
- operation : Object
onUpdateRecords( records, operation, success )privateUpdates any records when a write is returned from the server. ...Updates any records when a write is returned from the server.
Available since: 4.0.0
Parameters
- records : Ext.data.Model[]
The array of updated records
- operation : Ext.data.Operation
The operation that just completed
- success : Boolean
True if the operation was successful
relayEvents( origin, events, prefix )Relays selected events from the specified Observable as if the events were fired by this. ... removeAll( )inherit docs
Removes all records from the store. ...inherit docs
Removes all records from the store. This method does a "fast remove",
individual remove events are not called. The clear event is
fired upon completion.
Available since: Ext 1
Overrides: Ext.data.AbstractStore.removeAll
removeListener( eventName, fn, [scope] )Removes an event handler. ...Removes an event handler.
Available since: 1.1.0
Parameters
- eventName : String
The type of event the handler was associated with.
- fn : Function
The handler to remove. This must be a reference to the function passed into the
addListener call.
- scope : Object (optional)
The scope originally specified for the handler. It must be the same as the
scope argument specified in the original call to addListener or the listener will not be removed.
removeManagedListener( item, ename, [fn], [scope] )Removes listeners that were added by the mon method. ...Removes listeners that were added by the mon method.
Available since: 4.0.0
Parameters
- item : Ext.util.Observable/Ext.Element
The item from which to remove a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the ename parameter was an event name, this is the handler function.
- scope : Object (optional)
If the ename parameter was an event name, this is the scope (this reference)
in which the handler function is executed.
removeManagedListenerItem( isClear, managedListener )private resumeEvents( )Resumes firing events (see suspendEvents). ...Resumes firing events (see suspendEvents).
If events were suspended using the queueSuspended parameter, then all events fired
during event suspension will be sent to any listeners now.
Available since: 2.3.0
save( )privatedeprecated, will be removed in 5.0 ...deprecated, will be removed in 5.0
Available since: 4.0.0
inherit docs
Sets the Store's Proxy by string, config object or Proxy instance ...inherit docs
Sets the Store's Proxy by string, config object or Proxy instance
Available since: 4.0.0
Parameters
- proxy : String/Object/Ext.data.proxy.Proxy
The new Proxy, which can be either a type string, a configuration object
or an Ext.data.proxy.Proxy instance
Returns
- Ext.data.proxy.Proxy
The attached Proxy object
Overrides: Ext.data.AbstractStore.setProxy
Sets the root node for this store. ...Sets the root node for this store. See also the root config option.
Available since: 4.0.0
Parameters
Returns
- Ext.data.NodeInterface
The new root
Sorts the data in the Store by one or more of its properties. ...Sorts the data in the Store by one or more of its properties. Example usage:
//sort by a single field
myStore.sort('myField', 'DESC');
//sorting by multiple fields
myStore.sort([
{
property : 'age',
direction: 'ASC'
},
{
property : 'name',
direction: 'DESC'
}
]);
Internally, Store converts the passed arguments into an array of Ext.util.Sorter instances, and delegates
the actual sorting to its internal Ext.util.MixedCollection.
When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:
store.sort('myField');
store.sort('myField');
Is equivalent to this code, because Store handles the toggling automatically:
store.sort('myField', 'ASC');
store.sort('myField', 'DESC');
Available since: 4.0.0
Parameters
- sorters : String/Ext.util.Sorter[]
Either a string name of one of the fields in this Store's configured
Model, or an array of sorter configurations.
- direction : String
The overall direction to sort the data by. Defaults to "ASC".
Returns
Get the reference to the class from which this object was instantiated. ...Get the reference to the class from which this object was instantiated. Note that unlike self,
this.statics() is scope-independent and it always returns the class from which it was called, regardless of what
this points to during run-time
Ext.define('My.Cat', {
statics: {
totalCreated: 0,
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
var statics = this.statics();
alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to
// equivalent to: My.Cat.speciesName
alert(this.self.speciesName); // dependent on 'this'
statics.totalCreated++;
return this;
},
clone: function() {
var cloned = new this.self; // dependent on 'this'
cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName
return cloned;
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
},
constructor: function() {
this.callParent();
}
});
var cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
alert(clone.groupName); // alerts 'Cat'
alert(My.Cat.totalCreated); // alerts 3
Available since: 4.0.0
Returns
suspendEvents( queueSuspended )Suspends the firing of all events. ...Suspends the firing of all events. (see resumeEvents)
Available since: 2.3.0
Parameters
- queueSuspended : Boolean
Pass as true to queue up suspended events to be fired
after the resumeEvents call instead of discarding all suspended events.
sync( )Synchronizes the Store with its Proxy. ...Synchronizes the Store with its Proxy. This asks the Proxy to batch together any new, updated
and deleted records in the store, updating the Store's internal representation of the records
as each operation completes.
Available since: 4.0.0
un( eventName, fn, [scope] )Shorthand for removeListener. ...Shorthand for removeListener.
Removes an event handler.
Available since: 1.1.0
Parameters
- eventName : String
The type of event the handler was associated with.
- fn : Function
The handler to remove. This must be a reference to the function passed into the
addListener call.
- scope : Object (optional)
The scope originally specified for the handler. It must be the same as the
scope argument specified in the original call to addListener or the listener will not be removed.
Available since: 4.0.0
Parameters
- config : Object
Returns
Overrides: Ext.data.AbstractStore.constructor
Adds the specified events to the list of events which this Observable may fire.
Available since: 1.1.0
Parameters
- o : Object/String
Either an object with event names as properties with a value of
trueor the first event name string if multiple event names are being passed as separate parameters. Usage:this.addEvents({ storeloaded: true, storecleared: true }); - more : String... (optional)
Additional event names if multiple event names are being passed as separate parameters. Usage:
this.addEvents('storeloaded', 'storecleared');
Appends an event handler to this object.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to listen for. May also be an object who's property names are event names.
- fn : Function
The method the event invokes. Will be called with arguments given to fireEvent plus the
optionsparameter described below. - scope : Object (optional)
The scope (
thisreference) in which the handler function is executed. If omitted, defaults to the object which fired the event. - options : Object (optional)
An object containing handler configuration.
Note: Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.
This object may contain any of the following properties:
scope : Object
The scope (
thisreference) in which the handler function is executed. If omitted, defaults to the object which fired the event.delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
target : Observable
Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.
element : String
This option is only valid for listeners bound to Components. The name of a Component property which references an element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of Components which will exist only after the Component is rendered. For example, to add a click listener to a Panel's body:
new Ext.panel.Panel({ title: 'The title', listeners: { click: this.handlePanelClick, element: 'body' } });
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener.
myPanel.on('hide', this.handleClick, this, { single: true, delay: 100 });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 events. For example:
myGridPanel.on({ cellClick: this.onCellClick, mouseover: this.onMouseOver, mouseout: this.onMouseOut, scope: this // Important. Ensure "this" is correct during handler execution });One can also specify options for each event handler separately:
myGridPanel.on({ cellClick: {fn: this.onCellClick, scope: this, single: true}, mouseover: {fn: panel.onMouseOver, scope: panel} });
Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is destroyed.
Available since: 4.0.0
Parameters
- item : Ext.util.Observable/Ext.Element
The item to which to add a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the
enameparameter was an event name, this is the handler function. - scope : Object (optional)
If the
enameparameter was an event name, this is the scope (thisreference) in which the handler function is executed. - opt : Object (optional)
If the
enameparameter was an event name, this is the addListener options.
A model instance should call this method on the Store it has been joined to.
Available since: Ext 3
Parameters
- record : Ext.data.Model
The model instance that was edited
A model instance should call this method on the Store it has been joined to.
Available since: Ext 3
Parameters
- record : Ext.data.Model
The model instance that was edited
A model instance should call this method on the Store it has been joined to..
Available since: Ext 3
Parameters
- record : Ext.data.Model
The model instance that was edited
Call the original method that was previously overridden with override
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
return this;
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callOverridden();
alert("Meeeeoooowwww");
return instance;
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the
argumentsobject
Returns
- Object
Returns the result after calling the overridden method
Call the parent's overridden method. For example:
Ext.define('My.own.A', {
constructor: function(test) {
alert(test);
}
});
Ext.define('My.own.B', {
extend: 'My.own.A',
constructor: function(test) {
alert(test);
this.callParent([test + 1]);
}
});
Ext.define('My.own.C', {
extend: 'My.own.B',
constructor: function() {
alert("Going to call parent's overriden constructor...");
this.callParent(arguments);
}
});
var a = new My.own.A(1); // alerts '1'
var b = new My.own.B(1); // alerts '1', then alerts '2'
var c = new My.own.C(2); // alerts "Going to call parent's overriden constructor..."
// alerts '2', then alerts '3'
Available since: 4.0.0
Parameters
- args : Array/Arguments
The arguments, either an array or the
argumentsobject from the current method, for example:this.callParent(arguments)
Returns
- Object
Returns the result from the superclass' method
Removes all listeners for this object including the managed listeners
Available since: 4.0.0
Removes all managed listeners for this object.
Available since: 4.0.0
Normalizes an array of filter objects, ensuring that they are all Ext.util.Filter instances
Available since: 4.0.0
Parameters
- filters : Object[]
The filters array
Returns
- Ext.util.Filter[]
Array of Ext.util.Filter objects
Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances
Available since: 4.0.0
Parameters
- sorters : Object[]
The sorters array
Returns
- Ext.util.Sorter[]
Array of Ext.util.Sorter objects
tells the attached proxy to destroy the given records
Available since: Ext 3
Parameters
- options : Object
inherit docs
Available since: 4.0.0
Parameters
- sorterFn : Object
Overrides: Ext.data.AbstractStore.doSort
Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if
present. There is no implementation in the Observable base class.
This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to access the required target more quickly.
Example:
Ext.override(Ext.form.field.Base, {
// Add functionality to Field's initComponent to enable the change event to bubble
initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {
this.enableBubble('change');
}),
// We know that we want Field's events to bubble directly to the FormPanel.
getBubbleTarget : function() {
if (!this.formPanel) {
this.formPanel = this.findParentByType('form');
}
return this.formPanel;
}
});
var myForm = new Ext.formPanel({
title: 'User Details',
items: [{
...
}],
listeners: {
change: function() {
// Title goes red if form has been modified.
myForm.header.setStyle('color', 'red');
}
}
});
Available since: 3.4.0
Parameters
Fills a node with a series of child records.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node to fill
- records : Ext.data.Model[]
The records to add
Fires the specified event with the passed parameters (minus the event name, plus the options object passed
to addListener).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by calling enableBubble.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to fire.
- args : Object...
Variable number of parameters are passed to handlers.
Returns
- Boolean
returns false if any of the handlers return false otherwise it returns true.
Returns an object which is passed in as the listeners argument to proxy.batch inside this.sync. This is broken out into a separate function to allow for customisation of the listeners
Available since: 4.0.0
Returns
- Object
The listeners object
Gets the bubbling parent for an Observable
Available since: Ext JS 4.0.7
Returns
- Ext.util.Observable
The bubble parent. null is returned if no bubble target exists
inherit docs
Returns all Model instances that are either currently a phantom (e.g. have no id), or have an ID but have not yet been saved on this Store (this happens when adding a non-phantom record from another Store into this one)
Available since: 4.0.0
Returns
- Ext.data.Model[]
The Model instances
Overrides: Ext.data.AbstractStore.getNewRecords
Returns the proxy currently attached to this proxy instance
Available since: 4.0.0
Returns
- Ext.data.proxy.Proxy
The Proxy instance
Returns any records that have been removed from the store but not yet destroyed on the proxy.
Available since: 4.0.0
Returns
- Ext.data.Model[]
The removed Model instances
inherit docs
Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy
Available since: 4.0.0
Returns
- Ext.data.Model[]
The updated Model instances
Overrides: Ext.data.AbstractStore.getUpdatedRecords
Initialize configuration for this class. a typical example:
Ext.define('My.awesome.Class', {
// The default config
config: {
name: 'Awesome',
isAwesome: true
},
constructor: function(config) {
this.initConfig(config);
return this;
}
});
var awesome = new My.awesome.Class({
name: 'Super Awesome'
});
alert(awesome.getName()); // 'Super Awesome'
Available since: 4.0.0
Parameters
- config : Object
Returns
- Object
mixins The mixin prototypes as key - value pairs
Performs initialization of this mixin. Component classes using this mixin should call this method during their own initialization.
Available since: 4.0.0
Returns true if the Store is currently performing a load operation
Available since: 4.0.0
Returns
- Boolean
True if the Store is currently loading
Loads the Store using its configured proxy.
Available since: 4.0.0
Parameters
- options : Object (optional)
config object. This is passed into the Operation object that is created and then sent to the proxy's Ext.data.proxy.Proxy.read function. The options can also contain a node, which indicates which node is to be loaded. If not specified, it will default to the root node.
Overrides: Ext.data.AbstractStore.load
Shorthand for addManagedListener.
Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is destroyed.
Available since: 4.0.2
Parameters
- item : Ext.util.Observable/Ext.Element
The item to which to add a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the
enameparameter was an event name, this is the handler function. - scope : Object (optional)
If the
enameparameter was an event name, this is the scope (thisreference) in which the handler function is executed. - opt : Object (optional)
If the
enameparameter was an event name, this is the addListener options.
Shorthand for removeManagedListener.
Removes listeners that were added by the mon method.
Available since: 4.0.2
Parameters
- item : Ext.util.Observable/Ext.Element
The item from which to remove a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the
enameparameter was an event name, this is the handler function. - scope : Object (optional)
If the
enameparameter was an event name, this is the scope (thisreference) in which the handler function is executed.
Shorthand for addListener.
Appends an event handler to this object.
Available since: 1.1.0
Parameters
- eventName : String
The name of the event to listen for. May also be an object who's property names are event names.
- fn : Function
The method the event invokes. Will be called with arguments given to fireEvent plus the
optionsparameter described below. - scope : Object (optional)
The scope (
thisreference) in which the handler function is executed. If omitted, defaults to the object which fired the event. - options : Object (optional)
An object containing handler configuration.
Note: Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.
This object may contain any of the following properties:
scope : Object
The scope (
thisreference) in which the handler function is executed. If omitted, defaults to the object which fired the event.delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
target : Observable
Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.
element : String
This option is only valid for listeners bound to Components. The name of a Component property which references an element to add a listener to.
This option is useful during Component construction to add DOM event listeners to elements of Components which will exist only after the Component is rendered. For example, to add a click listener to a Panel's body:
new Ext.panel.Panel({ title: 'The title', listeners: { click: this.handlePanelClick, element: 'body' } });
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A delayed, one-time listener.
myPanel.on('hide', this.handleClick, this, { single: true, delay: 100 });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 events. For example:
myGridPanel.on({ cellClick: this.onCellClick, mouseover: this.onMouseOver, mouseout: this.onMouseOut, scope: this // Important. Ensure "this" is correct during handler execution });One can also specify options for each event handler separately:
myGridPanel.on({ cellClick: {fn: this.onCellClick, scope: this, single: true}, mouseover: {fn: panel.onMouseOver, scope: panel} });
Called before a node is collapsed.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node being collapsed.
- callback : Function
The function to run after the collapse finishes
- scope : Object
The scope in which to run the callback function
Called before a node is expanded.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node being expanded.
- callback : Function
The function to run after the expand finishes
- scope : Object
The scope in which to run the callback function
Creates any new records when a write is returned from the server.
Available since: 4.0.0
Parameters
- records : Ext.data.Model[]
The array of new records
- operation : Ext.data.Operation
The operation that just completed
- success : Boolean
True if the operation was successful
Removes any records when a write is returned from the server.
Available since: 4.0.0
Parameters
- records : Ext.data.Model[]
The array of removed records
- operation : Ext.data.Operation
The operation that just completed
- success : Boolean
True if the operation was successful
Callback for any write Operation over the Proxy. Updates the Store's MixedCollection to reflect the updates provided by the Proxy
Available since: 4.0.0
Parameters
- operation : Object
Updates any records when a write is returned from the server.
Available since: 4.0.0
Parameters
- records : Ext.data.Model[]
The array of updated records
- operation : Ext.data.Operation
The operation that just completed
- success : Boolean
True if the operation was successful
inherit docs
Removes all records from the store. This method does a "fast remove", individual remove events are not called. The clear event is fired upon completion.
Available since: Ext 1
Overrides: Ext.data.AbstractStore.removeAll
Removes an event handler.
Available since: 1.1.0
Parameters
- eventName : String
The type of event the handler was associated with.
- fn : Function
The handler to remove. This must be a reference to the function passed into the addListener call.
- scope : Object (optional)
The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to addListener or the listener will not be removed.
Removes listeners that were added by the mon method.
Available since: 4.0.0
Parameters
- item : Ext.util.Observable/Ext.Element
The item from which to remove a listener/listeners.
- ename : Object/String
The event name, or an object containing event name properties.
- fn : Function (optional)
If the
enameparameter was an event name, this is the handler function. - scope : Object (optional)
If the
enameparameter was an event name, this is the scope (thisreference) in which the handler function is executed.
Resumes firing events (see suspendEvents).
If events were suspended using the queueSuspended parameter, then all events fired
during event suspension will be sent to any listeners now.
Available since: 2.3.0
deprecated, will be removed in 5.0
Available since: 4.0.0
inherit docs
Sets the Store's Proxy by string, config object or Proxy instance
Available since: 4.0.0
Parameters
- proxy : String/Object/Ext.data.proxy.Proxy
The new Proxy, which can be either a type string, a configuration object or an Ext.data.proxy.Proxy instance
Returns
- Ext.data.proxy.Proxy
The attached Proxy object
Overrides: Ext.data.AbstractStore.setProxy
Sets the root node for this store. See also the root config option.
Available since: 4.0.0
Parameters
Returns
- Ext.data.NodeInterface
The new root
Sorts the data in the Store by one or more of its properties. Example usage:
//sort by a single field
myStore.sort('myField', 'DESC');
//sorting by multiple fields
myStore.sort([
{
property : 'age',
direction: 'ASC'
},
{
property : 'name',
direction: 'DESC'
}
]);
Internally, Store converts the passed arguments into an array of Ext.util.Sorter instances, and delegates the actual sorting to its internal Ext.util.MixedCollection.
When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:
store.sort('myField');
store.sort('myField');
Is equivalent to this code, because Store handles the toggling automatically:
store.sort('myField', 'ASC');
store.sort('myField', 'DESC');
Available since: 4.0.0
Parameters
- sorters : String/Ext.util.Sorter[]
Either a string name of one of the fields in this Store's configured Model, or an array of sorter configurations.
- direction : String
The overall direction to sort the data by. Defaults to "ASC".
Returns
Get the reference to the class from which this object was instantiated. Note that unlike self,
this.statics() is scope-independent and it always returns the class from which it was called, regardless of what
this points to during run-time
Ext.define('My.Cat', {
statics: {
totalCreated: 0,
speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
},
constructor: function() {
var statics = this.statics();
alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to
// equivalent to: My.Cat.speciesName
alert(this.self.speciesName); // dependent on 'this'
statics.totalCreated++;
return this;
},
clone: function() {
var cloned = new this.self; // dependent on 'this'
cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName
return cloned;
}
});
Ext.define('My.SnowLeopard', {
extend: 'My.Cat',
statics: {
speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
},
constructor: function() {
this.callParent();
}
});
var cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'
var snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'
var clone = snowLeopard.clone();
alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
alert(clone.groupName); // alerts 'Cat'
alert(My.Cat.totalCreated); // alerts 3
Available since: 4.0.0
Returns
Suspends the firing of all events. (see resumeEvents)
Available since: 2.3.0
Parameters
- queueSuspended : Boolean
Pass as true to queue up suspended events to be fired after the resumeEvents call instead of discarding all suspended events.
Synchronizes the Store with its Proxy. This asks the Proxy to batch together any new, updated and deleted records in the store, updating the Store's internal representation of the records as each operation completes.
Available since: 4.0.0
Shorthand for removeListener.
Removes an event handler.
Available since: 1.1.0
Parameters
- eventName : String
The type of event the handler was associated with.
- fn : Function
The handler to remove. This must be a reference to the function passed into the addListener call.
- scope : Object (optional)
The scope originally specified for the handler. It must be the same as the scope argument specified in the original call to addListener or the listener will not be removed.
Static Methods Add / override static properties of this class. ...Add / override static properties of this class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.addStatics({
someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'
method1: function() { ... }, // My.cool.Class.method1 = function() { ... };
method2: function() { ... } // My.cool.Class.method2 = function() { ... };
});
Available since: 4.0.2
Parameters
- members : Object
Returns
- Ext.Base
this
Borrow another class' members to the prototype of this class. ...Borrow another class' members to the prototype of this class.
Ext.define('Bank', {
money: '$$$',
printMoney: function() {
alert('$$$$$$$');
}
});
Ext.define('Thief', {
...
});
Thief.borrow(Bank, ['money', 'printMoney']);
var steve = new Thief();
alert(steve.money); // alerts '$$$'
steve.printMoney(); // alerts '$$$$$$$'
Available since: 4.0.2
Parameters
- fromClass : Ext.Base
The class to borrow members from
- members : String/String[]
The names of the members to borrow
Returns
- Ext.Base
this
Create a new instance of this Class. ...Create a new instance of this Class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.create({
someConfig: true
});
All parameters are passed to the constructor of the class.
Available since: 4.0.2
Returns
- Object
the created instance.
createAlias( alias, origin )staticCreate aliases for existing prototype methods. ...Create aliases for existing prototype methods. Example:
Ext.define('My.cool.Class', {
method1: function() { ... },
method2: function() { ... }
});
var test = new My.cool.Class();
My.cool.Class.createAlias({
method3: 'method1',
method4: 'method2'
});
test.method3(); // test.method1()
My.cool.Class.createAlias('method5', 'method3');
test.method5(); // test.method3() -> test.method1()
Available since: 4.0.2
Parameters
- alias : String/Object
The new method name, or an object to set multiple aliases. See
flexSetter
- origin : String/Object
The original method name
Get the current class' name in string format. ...Get the current class' name in string format.
Ext.define('My.cool.Class', {
constructor: function() {
alert(this.self.getName()); // alerts 'My.cool.Class'
}
});
My.cool.Class.getName(); // 'My.cool.Class'
Available since: 4.0.4
Returns
- String
className
implement( members )staticAdd methods / properties to the prototype of this class. ...Add methods / properties to the prototype of this class.
Ext.define('My.awesome.Cat', {
constructor: function() {
...
}
});
My.awesome.Cat.implement({
meow: function() {
alert('Meowww...');
}
});
var kitty = new My.awesome.Cat;
kitty.meow();
Available since: 4.0.2
Parameters
- members : Object
Override prototype members of this class. ...Override prototype members of this class. Overridden methods can be invoked via
callOverridden
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
return this;
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callOverridden();
alert("Meeeeoooowwww");
return instance;
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
Available since: 4.0.2
Parameters
- members : Object
Returns
- Ext.Base
this
Add / override static properties of this class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.addStatics({
someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'
method1: function() { ... }, // My.cool.Class.method1 = function() { ... };
method2: function() { ... } // My.cool.Class.method2 = function() { ... };
});
Available since: 4.0.2
Parameters
- members : Object
Returns
- Ext.Base
this
Borrow another class' members to the prototype of this class.
Ext.define('Bank', {
money: '$$$',
printMoney: function() {
alert('$$$$$$$');
}
});
Ext.define('Thief', {
...
});
Thief.borrow(Bank, ['money', 'printMoney']);
var steve = new Thief();
alert(steve.money); // alerts '$$$'
steve.printMoney(); // alerts '$$$$$$$'
Available since: 4.0.2
Parameters
- fromClass : Ext.Base
The class to borrow members from
- members : String/String[]
The names of the members to borrow
Returns
- Ext.Base
this
Create a new instance of this Class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.create({
someConfig: true
});
All parameters are passed to the constructor of the class.
Available since: 4.0.2
Returns
- Object
the created instance.
Create aliases for existing prototype methods. Example:
Ext.define('My.cool.Class', {
method1: function() { ... },
method2: function() { ... }
});
var test = new My.cool.Class();
My.cool.Class.createAlias({
method3: 'method1',
method4: 'method2'
});
test.method3(); // test.method1()
My.cool.Class.createAlias('method5', 'method3');
test.method5(); // test.method3() -> test.method1()
Available since: 4.0.2
Parameters
- alias : String/Object
The new method name, or an object to set multiple aliases. See flexSetter
- origin : String/Object
The original method name
Get the current class' name in string format.
Ext.define('My.cool.Class', {
constructor: function() {
alert(this.self.getName()); // alerts 'My.cool.Class'
}
});
My.cool.Class.getName(); // 'My.cool.Class'
Available since: 4.0.4
Returns
- String
className
Add methods / properties to the prototype of this class.
Ext.define('My.awesome.Cat', {
constructor: function() {
...
}
});
My.awesome.Cat.implement({
meow: function() {
alert('Meowww...');
}
});
var kitty = new My.awesome.Cat;
kitty.meow();
Available since: 4.0.2
Parameters
- members : Object
Override prototype members of this class. Overridden methods can be invoked via callOverridden
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
return this;
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callOverridden();
alert("Meeeeoooowwww");
return instance;
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
Available since: 4.0.2
Parameters
- members : Object
Returns
- Ext.Base
this
Events
Fired when a Model instance has been added to this Store
Available since: Ext 1
Parameters
- store : Ext.data.Store
The store
- records : Ext.data.Model[]
The Model instances that were added
- index : Number
The index at which the instances were inserted
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a new child node is appended
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- node : Ext.data.NodeInterface
The newly appended node
- index : Number
The index of the newly appended node
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a new child is appended, return false to cancel the append.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- node : Ext.data.NodeInterface
The child node to be appended
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before this node is collapsed.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
The collapsing node
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before this node is expanded.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
The expanding node
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a new child is inserted, return false to cancel the insert.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- node : Ext.data.NodeInterface
The child node to be inserted
- refNode : Ext.data.NodeInterface
The child node the node is being inserted before
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a request is made for a new data object. If the beforeload handler returns false the load action will be canceled.
Available since: Ext 1
Parameters
- store : Ext.data.Store
This Store
- operation : Ext.data.Operation
The Ext.data.Operation object that will be passed to the Proxy to load the Store
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before this node is moved to a new location in the tree. Return false to cancel the move.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- oldParent : Ext.data.NodeInterface
The parent of this node
- newParent : Ext.data.NodeInterface
The new parent this node is moving to
- index : Number
The index it is being moved to
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires before a child is removed, return false to cancel the remove.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- node : Ext.data.NodeInterface
The child node to be removed
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fired before a call to sync is executed. Return false from any listener to cancel the synv
Available since: 4.0.0
Parameters
- options : Object
Hash of all records to be synchronized, broken down into create, update and destroy
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fired after the removeAll method is called.
Available since: Ext 1
Parameters
- this : Ext.data.Store
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when this node is collapsed.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
The collapsing node
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires whenever the records in the Store have changed in some way - this could include adding or removing records, or updating the data in existing records
Available since: Ext 1
Parameters
- this : Ext.data.Store
The data store
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when this node is expanded.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
The expanding node
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a new child node is inserted.
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- node : Ext.data.NodeInterface
The child node inserted
- refNode : Ext.data.NodeInterface
The child node the node was inserted before
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires whenever the store reads data from a remote data source.
Available since: 4.0.0
Parameters
- this : Ext.data.TreeStore
- node : Ext.data.NodeInterface
The node that was loaded.
- records : Ext.data.Model[]
An array of records.
- successful : Boolean
True if the operation was successful.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Overrides: Ext.data.AbstractStore.load
Fires when this node is moved to a new location in the tree
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- oldParent : Ext.data.NodeInterface
The old parent of this node
- newParent : Ext.data.NodeInterface
The new parent of this node
- index : Number
The index it was moved to
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a child node is removed
Available since: 4.0.0
Parameters
- this : Ext.data.NodeInterface
This node
- node : Ext.data.NodeInterface
The removed node
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Overrides: Ext.data.AbstractStore.remove
Fires whenever the root node is changed in the tree.
Available since: 4.0.0
Parameters
- root : Ext.data.Model
The new root
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when this TreeStore is sorted.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node that is sorted.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires when a Model instance has been updated
Available since: Ext 1
Parameters
- this : Ext.data.Store
- record : Ext.data.Model
The Model instance that was updated
- operation : String
The update operation being performed. Value may be one of:
Ext.data.Model.EDIT Ext.data.Model.REJECT Ext.data.Model.COMMIT - eOpts : Object
The options object passed to Ext.util.Observable.addListener.
Fires whenever a successful write has been made via the configured Proxy
Available since: Ext 3
Parameters
- store : Ext.data.Store
This Store
- operation : Ext.data.Operation
The Operation object that was used in the write
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.