Ext.data.NodeInterface
Hierarchy
Ext.BaseExt.data.NodeInterfaceRequires
Files
This class is used as a set of methods that are applied to the prototype of a Model to decorate it with a Node API. This means that models used in conjunction with a tree will have all of the tree related methods available on the model. In general this class will not be used directly by the developer. This class also creates extra fields on the model if they do not exist, to help maintain the tree state and UI. These fields are documented as config options.
Available since: 4.0.0
Config options
Set to false to deny dragging of this node.
Defaults to: true
Available since: 4.0.6
Set to false to deny dropping on this node.
Defaults to: true
Available since: 4.0.6
Set to true or false to show a checkbox alongside this node.
Defaults to: null
Available since: 4.0.6
The number of parents this node has. A root node has depth 0, a child of it depth 1, and so on...
Available since: 4.0.6
Set to true to allow for expanding/collapsing of this node.
Defaults to: false
Available since: 4.0.6
True if the node is expanded.
Defaults to: false
Available since: 4.0.6
An URL for a link that's created when this config is specified.
An URL for a link that's created when this config is specified.
Available since: 4.0.6
Target for link. Only applicable when href also specified.
Available since: 4.0.6
CSS class to apply for this node's icon.
CSS class to apply for this node's icon.
Available since: 4.0.6
The position of the node inside its parent. When parent has 4 children and the node is third amongst them, index will be 2.
Available since: 4.0.6
Set to true to indicate that this child can have no children. The expand icon/arrow will then not be rendered for this node.
Defaults to: false
Available since: 4.0.6
True if the node has finished loading.
Defaults to: false
Available since: 4.0.6
True if the node is currently loading.
Defaults to: false
Available since: 4.0.6
Properties
An array of this nodes children. Array will be empty if this node has no chidren.
Available since: 4.0.4
A reference to this node's first child node. null if this node has no children.
Available since: 4.0.4
A reference to this node's last child node. null if this node has no children.
Available since: 4.0.4
A reference to this node's next sibling node. null if this node does not have a next sibling.
Available since: 4.0.4
A reference to this node's parent node. null if this node is the root node.
Available since: 4.0.4
A reference to this node's previous sibling node. null if this node does not have a previous sibling.
Available since: 4.0.4
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
Methods
Instance Methods Inserts node(s) as the last child node of this node. ...Inserts node(s) as the last child node of this node.
If the node was previously a child node of another parent node, it will be removed from that node first.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface/Ext.data.NodeInterface[]
The node or Array of nodes to append
Returns
- Ext.data.NodeInterface
The appended node if single append, or null if an array was passed
bubble( fn, [scope], [args] )Bubbles up the tree from this node, calling the specified function with each node. ...Bubbles up the tree from this node, calling the specified function with each node. The arguments to the function
will be the args provided or the current node. If the function returns false at any point,
the bubble is stopped.
Available since: 4.0.0
Parameters
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
cascadeBy( fn, [scope], [args] )Cascades down the tree from this node, calling the specified function with each node. ...Cascades down the tree from this node, calling the specified function with each node. The arguments to the function
will be the args provided or the current node. If the function returns false at any point,
the cascade is stopped on that branch.
Available since: 4.0.0
Parameters
clear( [destroy] )privateClears the node. ...Clears the node.
Available since: 4.0.0
Parameters
- destroy : Boolean (optional)
True to destroy the node.
Defaults to: false
collapseChildren( [recursive], [callback], [scope] )Collapse all the children of this node. ...Collapse all the children of this node.
Available since: 4.0.0
Parameters
Returns true if this node is an ancestor (at any point) of the passed node. ...Returns true if this node is an ancestor (at any point) of the passed node.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
Returns
Creates a copy (clone) of this Node. ...Creates a copy (clone) of this Node.
Available since: 4.0.0
Parameters
- id : String (optional)
A new id, defaults to this Node's id.
- deep : Boolean (optional)
True to recursively copy all child Nodes into the new Node.
False to copy without child Nodes.
Defaults to: false
Returns
- Ext.data.NodeInterface
A copy of this Node.
eachChild( fn, [scope], [args] )Interates the child nodes of this node, calling the specified function with each node. ...Interates the child nodes of this node, calling the specified function with each node. The arguments to the function
will be the args provided or the current node. If the function returns false at any point,
the iteration stops.
Available since: 4.0.0
Parameters
expandChildren( [recursive], [callback], [scope] )Expand all the children of this node. ...Expand all the children of this node.
Available since: 4.0.0
Parameters
Finds the first child that has the attribute with the specified value. ...Finds the first child that has the attribute with the specified value.
Available since: 4.0.0
Parameters
- attribute : String
The attribute name
- value : Object
The value to search for
- deep : Boolean (optional)
True to search through nodes deeper than the immediate children
Defaults to: false
Returns
- Ext.data.NodeInterface
The found child or null if none was found
Finds the first child by a custom function. ...Finds the first child by a custom function. The child matches if the function passed returns true.
Available since: 4.0.0
Parameters
- fn : Function
A function which must return true if the passed Node is the required Node.
- scope : Object (optional)
The scope (this reference) in which the function is executed. Defaults to the Node being tested.
- deep : Boolean (optional)
True to search through nodes deeper than the immediate children
Defaults to: false
Returns
- Ext.data.NodeInterface
The found child or null if none was found
Returns the child node at the specified index. ...Returns the child node at the specified index.
Available since: 4.0.0
Parameters
- index : Number
Returns
hasChildNodes( ) : BooleanReturns true if this node has one or more child nodes, else false. ...Returns true if this node has one or more child nodes, else false.
Available since: 4.0.0
Returns
Returns the index of a child node ...Returns the index of a child node
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
Returns
- Number
The index of the node or -1 if it was not found
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
Inserts the first node before the second node in this nodes childNodes collection. ...Inserts the first node before the second node in this nodes childNodes collection.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node to insert
- refNode : Ext.data.NodeInterface
The node to insert before (if null the node is appended)
Returns
- Ext.data.NodeInterface
The inserted node
Insert a node into this node ...Insert a node into this node
Available since: 4.0.0
Parameters
- index : Number
The zero-based index to insert the node at
- node : Ext.data.Model
The node to insert
Returns
- Ext.data.Model
The record you just inserted
Returns true if the passed node is an ancestor (at any point) of this node. ...Returns true if the passed node is an ancestor (at any point) of this node.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
Returns
isExpandable( ) : BooleanReturns true if this node has one or more child nodes, or if the expandable
node attribute is explicitly specified as...Returns true if this node has one or more child nodes, or if the expandable
node attribute is explicitly specified as true, otherwise returns false.
Available since: 4.0.0
Returns
mixin( name, cls )private Removes this node from its parent ...Removes this node from its parent
Available since: 4.0.0
Parameters
- destroy : Boolean (optional)
True to destroy the node upon removal.
Defaults to: false
Returns
Removes all child nodes from this node. ...Removes all child nodes from this node.
Available since: 4.0.0
Parameters
- destroy : Boolean (optional)
<True to destroy the node upon removal.
Defaults to: false
Returns
Removes a child node from this node. ...Removes a child node from this node.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node to remove
- destroy : Boolean (optional)
True to destroy the node upon removal.
Defaults to: false
Returns
- Ext.data.NodeInterface
The removed node
Replaces one child node in this node with another. ...Replaces one child node in this node with another.
Available since: 4.0.0
Parameters
- newChild : Ext.data.NodeInterface
The replacement node
- oldChild : Ext.data.NodeInterface
The node to replace
Returns
- Ext.data.NodeInterface
The replaced node
sort( fn, [recursive], [suppressEvent] )Sorts this nodes children using the supplied sort function. ...Sorts this nodes children using the supplied sort function.
Available since: 4.0.0
Parameters
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
Inserts node(s) as the last child node of this node.
If the node was previously a child node of another parent node, it will be removed from that node first.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface/Ext.data.NodeInterface[]
The node or Array of nodes to append
Returns
- Ext.data.NodeInterface
The appended node if single append, or null if an array was passed
Bubbles up the tree from this node, calling the specified function with each node. The arguments to the function will be the args provided or the current node. If the function returns false at any point, the bubble is stopped.
Available since: 4.0.0
Parameters
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
Cascades down the tree from this node, calling the specified function with each node. The arguments to the function will be the args provided or the current node. If the function returns false at any point, the cascade is stopped on that branch.
Available since: 4.0.0
Parameters
Clears the node.
Available since: 4.0.0
Parameters
- destroy : Boolean (optional)
True to destroy the node.
Defaults to:
false
Collapse all the children of this node.
Available since: 4.0.0
Parameters
Returns true if this node is an ancestor (at any point) of the passed node.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
Returns
Creates a copy (clone) of this Node.
Available since: 4.0.0
Parameters
- id : String (optional)
A new id, defaults to this Node's id.
- deep : Boolean (optional)
True to recursively copy all child Nodes into the new Node. False to copy without child Nodes.
Defaults to:
false
Returns
- Ext.data.NodeInterface
A copy of this Node.
Interates the child nodes of this node, calling the specified function with each node. The arguments to the function will be the args provided or the current node. If the function returns false at any point, the iteration stops.
Available since: 4.0.0
Parameters
Expand all the children of this node.
Available since: 4.0.0
Parameters
Finds the first child that has the attribute with the specified value.
Available since: 4.0.0
Parameters
- attribute : String
The attribute name
- value : Object
The value to search for
- deep : Boolean (optional)
True to search through nodes deeper than the immediate children
Defaults to:
false
Returns
- Ext.data.NodeInterface
The found child or null if none was found
Finds the first child by a custom function. The child matches if the function passed returns true.
Available since: 4.0.0
Parameters
- fn : Function
A function which must return true if the passed Node is the required Node.
- scope : Object (optional)
The scope (this reference) in which the function is executed. Defaults to the Node being tested.
- deep : Boolean (optional)
True to search through nodes deeper than the immediate children
Defaults to:
false
Returns
- Ext.data.NodeInterface
The found child or null if none was found
Returns the child node at the specified index.
Available since: 4.0.0
Parameters
- index : Number
Returns
Returns true if this node has one or more child nodes, else false.
Available since: 4.0.0
Returns
Returns the index of a child node
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
Returns
- Number
The index of the node or -1 if it was not found
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
Inserts the first node before the second node in this nodes childNodes collection.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node to insert
- refNode : Ext.data.NodeInterface
The node to insert before (if null the node is appended)
Returns
- Ext.data.NodeInterface
The inserted node
Insert a node into this node
Available since: 4.0.0
Parameters
- index : Number
The zero-based index to insert the node at
- node : Ext.data.Model
The node to insert
Returns
- Ext.data.Model
The record you just inserted
Returns true if the passed node is an ancestor (at any point) of this node.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
Returns
Returns true if this node has one or more child nodes, or if the expandable node attribute is explicitly specified as true, otherwise returns false.
Available since: 4.0.0
Returns
Removes this node from its parent
Available since: 4.0.0
Parameters
- destroy : Boolean (optional)
True to destroy the node upon removal.
Defaults to:
false
Returns
Removes all child nodes from this node.
Available since: 4.0.0
Parameters
- destroy : Boolean (optional)
<True to destroy the node upon removal.
Defaults to:
false
Returns
Removes a child node from this node.
Available since: 4.0.0
Parameters
- node : Ext.data.NodeInterface
The node to remove
- destroy : Boolean (optional)
True to destroy the node upon removal.
Defaults to:
false
Returns
- Ext.data.NodeInterface
The removed node
Replaces one child node in this node with another.
Available since: 4.0.0
Parameters
- newChild : Ext.data.NodeInterface
The replacement node
- oldChild : Ext.data.NodeInterface
The node to replace
Returns
- Ext.data.NodeInterface
The replaced node
Sorts this nodes children using the supplied sort function.
Available since: 4.0.0
Parameters
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
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
applyFields( modelClass, addFields )privatestatic 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
decorate( record )staticThis method allows you to decorate a Record's prototype to implement the NodeInterface. ...This method allows you to decorate a Record's prototype to implement the NodeInterface.
This adds a set of methods, new events, new properties and new fields on every Record
with the same Model as the passed Record.
Available since: 4.0.0
Parameters
- record : Ext.data.Model
The Record you want to decorate the prototype of.
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
This method allows you to decorate a Record's prototype to implement the NodeInterface. This adds a set of methods, new events, new properties and new fields on every Record with the same Model as the passed Record.
Available since: 4.0.0
Parameters
- record : Ext.data.Model
The Record you want to decorate the prototype of.
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
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 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.
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 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 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.
Fires when this node's childNodes are sorted.
Available since: 4.0.2
Parameters
- this : Ext.data.NodeInterface
This node.
- childNodes : Ext.data.NodeInterface[]
The childNodes of this node.
- eOpts : Object
The options object passed to Ext.util.Observable.addListener.