X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/docs/output/Ext.data.reader.Reader.js diff --git a/docs/output/Ext.data.reader.Reader.js b/docs/output/Ext.data.reader.Reader.js index 077a32c1..c5112aba 100644 --- a/docs/output/Ext.data.reader.Reader.js +++ b/docs/output/Ext.data.reader.Reader.js @@ -1,241 +1 @@ -Ext.data.JsonP.Ext_data_reader_Reader({ - "tagname": "class", - "name": "Ext.data.reader.Reader", - "doc": "
Readers are used to interpret data to be loaded into a Model instance or a Store\n- usually in response to an AJAX request. This is normally handled transparently by passing some configuration to either the \nModel or the Store in question - see their documentation for further details.
\n\n\n\n\nLoading Nested Data
\n\n\n\n\nReaders have the ability to automatically load deeply-nested data objects based on the associations\nconfigured on each Model. Below is an example demonstrating the flexibility of these associations in a fictional CRM system which\nmanages a User, their Orders, OrderItems and Products. First we'll define the models:\n\n
Ext.define(\"User\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'name'\n ],\n\n hasMany: {model: 'Order', name: 'orders'},\n\n proxy: {\n type: 'rest',\n url : 'users.json',\n reader: {\n type: 'json',\n root: 'users'\n }\n }\n});\n\nExt.define(\"Order\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'total'\n ],\n\n hasMany : {model: 'OrderItem', name: 'orderItems', associationKey: 'order_items'},\n belongsTo: 'User'\n});\n\nExt.define(\"OrderItem\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'price', 'quantity', 'order_id', 'product_id'\n ],\n\n belongsTo: ['Order', {model: 'Product', associationKey: 'product'}]\n});\n\nExt.define(\"Product\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'name'\n ],\n\n hasMany: 'OrderItem'\n});\n
\n\nThis may be a lot to take in - basically a User has many Orders, each of which is composed of several OrderItems. Finally,\neach OrderItem has a single Product. This allows us to consume data like this:
\n\n{\n \"users\": [\n {\n \"id\": 123,\n \"name\": \"Ed\",\n \"orders\": [\n {\n \"id\": 50,\n \"total\": 100,\n \"order_items\": [\n {\n \"id\" : 20,\n \"price\" : 40,\n \"quantity\": 2,\n \"product\" : {\n \"id\": 1000,\n \"name\": \"MacBook Pro\"\n }\n },\n {\n \"id\" : 21,\n \"price\" : 20,\n \"quantity\": 3,\n \"product\" : {\n \"id\": 1001,\n \"name\": \"iPhone\"\n }\n }\n ]\n }\n ]\n }\n ]\n}\n
\n\nThe JSON response is deeply nested - it returns all Users (in this case just 1 for simplicity's sake), all of the Orders\nfor each User (again just 1 in this case), all of the OrderItems for each Order (2 order items in this case), and finally\nthe Product associated with each OrderItem. Now we can read the data and use it as follows:\n\n
var store = new Ext.data.Store({\n model: \"User\"\n});\n\nstore.load({\n callback: function() {\n //the user that was loaded\n var user = store.first();\n\n console.log(\"Orders for \" + user.get('name') + \":\")\n\n //iterate over the Orders for each User\n user.orders().each(function(order) {\n console.log(\"Order ID: \" + order.getId() + \", which contains items:\");\n\n //iterate over the OrderItems for each Order\n order.orderItems().each(function(orderItem) {\n //we know that the Product data is already loaded, so we can use the synchronous getProduct\n //usually, we would use the asynchronous version (see Ext.data.BelongsToAssociation)\n var product = orderItem.getProduct();\n\n console.log(orderItem.get('quantity') + ' orders of ' + product.get('name'));\n });\n });\n }\n});\n
\n\nRunning the code above results in the following:
\n\nOrders for Ed:\nOrder ID: 50, which contains items:\n2 orders of MacBook Pro\n3 orders of iPhone\n
\n\n",
- "extends": "Object",
- "mixins": [
-
- ],
- "alternateClassNames": [
- "Ext.data.Reader",
- "Ext.data.DataReader"
- ],
- "xtype": null,
- "author": "Ed Spencer",
- "docauthor": null,
- "singleton": false,
- "private": false,
- "cfg": [
- {
- "tagname": "cfg",
- "name": "idProperty",
- "member": "Ext.data.reader.Reader",
- "type": "String",
- "doc": "Name of the property within a row object\nthat contains a record identifier value. Defaults to The id of the model.\nIf an idProperty is explicitly specified it will override that of the one specified\non the model
\n", - "private": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 153, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-cfg-idProperty", - "shortDoc": "Name of the property within a row object\nthat contains a record identifier value. Defaults to The id of the model.\nI..." - }, - { - "tagname": "cfg", - "name": "implicitIncludes", - "member": "Ext.data.reader.Reader", - "type": "Boolean", - "doc": "True to automatically parse models nested within other models in a response\nobject. See the Ext.data.reader.Reader intro docs for full explanation. Defaults to true.
\n", - "private": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 190, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-cfg-implicitIncludes", - "shortDoc": "True to automatically parse models nested within other models in a response\nobject. See the Ext.data.reader.Reader in..." - }, - { - "tagname": "cfg", - "name": "messageProperty", - "member": "Ext.data.reader.Reader", - "type": "String", - "doc": "The name of the property which contains a response message.\nThis property is optional.
\n", - "private": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 185, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-cfg-messageProperty" - }, - { - "tagname": "cfg", - "name": "root", - "member": "Ext.data.reader.Reader", - "type": "String", - "doc": "Required. The name of the property\nwhich contains the Array of row objects. Defaults to undefined.\nAn exception will be thrown if the root property is undefined. The data\npacket value for this property should be an empty array to clear the data\nor show no data.
\n", - "private": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 176, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-cfg-root", - "shortDoc": "Required. The name of the property\nwhich contains the Array of row objects. Defaults to undefined.\nAn exception wil..." - }, - { - "tagname": "cfg", - "name": "successProperty", - "member": "Ext.data.reader.Reader", - "type": "String", - "doc": "Name of the property from which to\nretrieve the success attribute. Defaults to success. See\nExt.data.proxy.Proxy.exception\nfor additional information.
\n", - "private": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 168, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-cfg-successProperty", - "shortDoc": "Name of the property from which to\nretrieve the success attribute. Defaults to success. See\nExt.data.proxy.Proxy.exc..." - }, - { - "tagname": "cfg", - "name": "totalProperty", - "member": "Ext.data.reader.Reader", - "type": "String", - "doc": "Name of the property from which to\nretrieve the total number of records in the dataset. This is only needed\nif the whole dataset is not passed in one go, but is being paged from\nthe remote server. Defaults to total.
\n", - "private": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 160, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-cfg-totalProperty", - "shortDoc": "Name of the property from which to\nretrieve the total number of records in the dataset. This is only needed\nif the wh..." - } - ], - "method": [ - { - "tagname": "method", - "name": "Reader", - "member": "Ext.data.reader.Reader", - "doc": "\n", - "params": [ - { - "type": "Object", - "name": "config", - "doc": "Optional config object
\n", - "optional": false - } - ], - "return": { - "type": "void", - "doc": "\n" - }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 1, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-method-constructor", - "shortDoc": "\n" - }, - { - "tagname": "method", - "name": "getResponseData", - "member": "Ext.data.reader.Reader", - "doc": "Takes a raw response object (as passed to this.read) and returns the useful data segment of it. This must be implemented by each subclass
\n", - "params": [ - { - "type": "Object", - "name": "response", - "doc": "The responce object
\n", - "optional": false - } - ], - "return": { - "type": "Object", - "doc": "The useful data from the response
\n" - }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 458, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-method-getResponseData", - "shortDoc": "Takes a raw response object (as passed to this.read) and returns the useful data segment of it. This must be implemen..." - }, - { - "tagname": "method", - "name": "read", - "member": "Ext.data.reader.Reader", - "doc": "Reads the given response object. This method normalizes the different types of response object that may be passed\nto it, before handing off the reading of records to the readRecords function.
\n", - "params": [ - { - "type": "Object", - "name": "response", - "doc": "The response object. This may be either an XMLHttpRequest object or a plain JS object
\n", - "optional": false - } - ], - "return": { - "type": "Ext.data.ResultSet", - "doc": "The parsed ResultSet object
\n" - }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 226, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-method-read", - "shortDoc": "Reads the given response object. This method normalizes the different types of response object that may be passed\nto ..." - }, - { - "tagname": "method", - "name": "readRecords", - "member": "Ext.data.reader.Reader", - "doc": "Abstracts common functionality used by all Reader subclasses. Each subclass is expected to call\nthis function before running its own logic and returning the Ext.data.ResultSet instance. For most\nReaders additional processing should not be needed.
\n", - "params": [ - { - "type": "Mixed", - "name": "data", - "doc": "The raw data object
\n", - "optional": false - } - ], - "return": { - "type": "Ext.data.ResultSet", - "doc": "A ResultSet object
\n" - }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 246, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-method-readRecords", - "shortDoc": "Abstracts common functionality used by all Reader subclasses. Each subclass is expected to call\nthis function before ..." - } - ], - "property": [ - { - "tagname": "property", - "name": "rawData", - "member": "Ext.data.reader.Reader", - "type": "Mixed", - "doc": "The raw data object that was last passed to readRecords. Stored for further processing if needed
\n", - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 266, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader-property-rawData" - } - ], - "event": [ - - ], - "filename": "/Users/nick/Projects/sencha/SDK/platform/src/data/reader/Reader.js", - "linenr": 1, - "html_filename": "Reader.html", - "href": "Reader.html#Ext-data-reader-Reader", - "cssVar": [ - - ], - "cssMixin": [ - - ], - "component": false, - "superclasses": [ - - ], - "subclasses": [ - "Ext.data.reader.Json", - "Ext.data.reader.Xml" - ], - "mixedInto": [ - - ], - "allMixins": [ - - ] -}); \ No newline at end of file +Ext.data.JsonP.Ext_data_reader_Reader({"tagname":"class","html":"Alternate names
Ext.data.ReaderExt.data.DataReaderHierarchy
Ext.BaseExt.data.reader.ReaderRequires
Files
Readers are used to interpret data to be loaded into a Model instance or a Store - often in response to an AJAX request. In general there is usually no need to create\na Reader instance directly, since a Reader is almost always used together with a Proxy,\nand is configured using the Proxy's reader configuration property:
\n\nExt.create('Ext.data.Store', {\n model: 'User',\n proxy: {\n type: 'ajax',\n url : 'users.json',\n reader: {\n type: 'json',\n root: 'users'\n }\n },\n});\n
\n\nThe above reader is configured to consume a JSON string that looks something like this:
\n\n{\n \"success\": true,\n \"users\": [\n { \"name\": \"User 1\" },\n { \"name\": \"User 2\" }\n ]\n}\n
\n\nReaders have the ability to automatically load deeply-nested data objects based on the associations configured on each Model. Below is an example demonstrating the flexibility of these associations in a\nfictional CRM system which manages a User, their Orders, OrderItems and Products. First we'll define the models:
\n\nExt.define(\"User\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'name'\n ],\n\n hasMany: {model: 'Order', name: 'orders'},\n\n proxy: {\n type: 'rest',\n url : 'users.json',\n reader: {\n type: 'json',\n root: 'users'\n }\n }\n});\n\nExt.define(\"Order\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'total'\n ],\n\n hasMany : {model: 'OrderItem', name: 'orderItems', associationKey: 'order_items'},\n belongsTo: 'User'\n});\n\nExt.define(\"OrderItem\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'price', 'quantity', 'order_id', 'product_id'\n ],\n\n belongsTo: ['Order', {model: 'Product', associationKey: 'product'}]\n});\n\nExt.define(\"Product\", {\n extend: 'Ext.data.Model',\n fields: [\n 'id', 'name'\n ],\n\n hasMany: 'OrderItem'\n});\n
\n\nThis may be a lot to take in - basically a User has many Orders, each of which is composed of several OrderItems.\nFinally, each OrderItem has a single Product. This allows us to consume data like this:
\n\n{\n \"users\": [\n {\n \"id\": 123,\n \"name\": \"Ed\",\n \"orders\": [\n {\n \"id\": 50,\n \"total\": 100,\n \"order_items\": [\n {\n \"id\" : 20,\n \"price\" : 40,\n \"quantity\": 2,\n \"product\" : {\n \"id\": 1000,\n \"name\": \"MacBook Pro\"\n }\n },\n {\n \"id\" : 21,\n \"price\" : 20,\n \"quantity\": 3,\n \"product\" : {\n \"id\": 1001,\n \"name\": \"iPhone\"\n }\n }\n ]\n }\n ]\n }\n ]\n}\n
\n\nThe JSON response is deeply nested - it returns all Users (in this case just 1 for simplicity's sake), all of the\nOrders for each User (again just 1 in this case), all of the OrderItems for each Order (2 order items in this case),\nand finally the Product associated with each OrderItem. Now we can read the data and use it as follows:
\n\nvar store = Ext.create('Ext.data.Store', {\n model: \"User\"\n});\n\nstore.load({\n callback: function() {\n //the user that was loaded\n var user = store.first();\n\n console.log(\"Orders for \" + user.get('name') + \":\")\n\n //iterate over the Orders for each User\n user.orders().each(function(order) {\n console.log(\"Order ID: \" + order.getId() + \", which contains items:\");\n\n //iterate over the OrderItems for each Order\n order.orderItems().each(function(orderItem) {\n //we know that the Product data is already loaded, so we can use the synchronous getProduct\n //usually, we would use the asynchronous version (see Ext.data.BelongsToAssociation)\n var product = orderItem.getProduct();\n\n console.log(orderItem.get('quantity') + ' orders of ' + product.get('name'));\n });\n });\n }\n});\n
\n\nRunning the code above results in the following:
\n\nOrders for Ed:\nOrder ID: 50, which contains items:\n2 orders of MacBook Pro\n3 orders of iPhone\n
\nName of the property within a row object that contains a record identifier value. Defaults to The id of the\nmodel. If an idProperty is explicitly specified it will override that of the one specified on the model
\nTrue to automatically parse models nested within other models in a response object. See the\nExt.data.reader.Reader intro docs for full explanation. Defaults to true.
\nDefaults to: true
The name of the property which contains a response message. This property is optional.
\nThe name of the property which contains the Array of row objects. For JSON reader it's dot-separated list\nof property names. For XML reader it's a CSS selector. For array reader it's not applicable.
\n\nBy default the natural root of the data will be used. The root Json array, the root XML element, or the array.
\n\nThe data packet value for this property should be an empty array to clear the data or show no data.
\nDefaults to: ""
Name of the property from which to retrieve the success attribute. Defaults to success. See\nExt.data.proxy.Server.exception for additional information.
\nDefaults to: "success"
Name of the property from which to retrieve the total number of records in the dataset. This is only needed if\nthe whole dataset is not passed in one go, but is being paged from the remote server. Defaults to total.
\nDefaults to: "total"
The raw data object that was last passed to readRecords. Stored for further processing if needed
\nGet the reference to the current class from which this object was instantiated. Unlike statics,\nthis.self
is scope-dependent and it's meant to be used for dynamic inheritance. See statics\nfor a detailed comparison
Ext.define('My.Cat', {\n statics: {\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n alert(this.self.speciesName); / dependent on 'this'\n\n return this;\n },\n\n clone: function() {\n return new this.self();\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat'\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\n
\nCall the original method that was previously overridden with override
\n\nExt.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n\n return this;\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n var instance = this.callOverridden();\n\n alert(\"Meeeeoooowwww\");\n\n return instance;\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n
\nThe arguments, either an array or the arguments
object
Returns the result after calling the overridden method
\nCall the parent's overridden method. For example:
\n\nExt.define('My.own.A', {\n constructor: function(test) {\n alert(test);\n }\n});\n\nExt.define('My.own.B', {\n extend: 'My.own.A',\n\n constructor: function(test) {\n alert(test);\n\n this.callParent([test + 1]);\n }\n});\n\nExt.define('My.own.C', {\n extend: 'My.own.B',\n\n constructor: function() {\n alert(\"Going to call parent's overriden constructor...\");\n\n this.callParent(arguments);\n }\n});\n\nvar a = new My.own.A(1); // alerts '1'\nvar b = new My.own.B(1); // alerts '1', then alerts '2'\nvar c = new My.own.C(2); // alerts \"Going to call parent's overriden constructor...\"\n // alerts '2', then alerts '3'\n
\nThe arguments, either an array or the arguments
object\nfrom the current method, for example: this.callParent(arguments)
Returns the result from the superclass' method
\nInitialize configuration for this class. a typical example:
\n\nExt.define('My.awesome.Class', {\n // The default config\n config: {\n name: 'Awesome',\n isAwesome: true\n },\n\n constructor: function(config) {\n this.initConfig(config);\n\n return this;\n }\n});\n\nvar awesome = new My.awesome.Class({\n name: 'Super Awesome'\n});\n\nalert(awesome.getName()); // 'Super Awesome'\n
\nmixins The mixin prototypes as key - value pairs
\nReads the given response object. This method normalizes the different types of response object that may be passed\nto it, before handing off the reading of records to the readRecords function.
\nThe response object. This may be either an XMLHttpRequest object or a plain JS object
\nThe parsed ResultSet object
\nAbstracts common functionality used by all Reader subclasses. Each subclass is expected to call this function\nbefore running its own logic and returning the Ext.data.ResultSet instance. For most Readers additional\nprocessing should not be needed.
\nThe raw data object
\nA ResultSet object
\nGet the reference to the class from which this object was instantiated. Note that unlike self,\nthis.statics()
is scope-independent and it always returns the class from which it was called, regardless of what\nthis
points to during run-time
Ext.define('My.Cat', {\n statics: {\n totalCreated: 0,\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n var statics = this.statics();\n\n alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to\n // equivalent to: My.Cat.speciesName\n\n alert(this.self.speciesName); // dependent on 'this'\n\n statics.totalCreated++;\n\n return this;\n },\n\n clone: function() {\n var cloned = new this.self; // dependent on 'this'\n\n cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName\n\n return cloned;\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n },\n\n constructor: function() {\n this.callParent();\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'\n\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\nalert(clone.groupName); // alerts 'Cat'\n\nalert(My.Cat.totalCreated); // alerts 3\n
\nAdd / override static properties of this class.
\n\nExt.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.addStatics({\n someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'\n method1: function() { ... }, // My.cool.Class.method1 = function() { ... };\n method2: function() { ... } // My.cool.Class.method2 = function() { ... };\n});\n
\nthis
\nBorrow another class' members to the prototype of this class.
\n\nExt.define('Bank', {\n money: '$$$',\n printMoney: function() {\n alert('$$$$$$$');\n }\n});\n\nExt.define('Thief', {\n ...\n});\n\nThief.borrow(Bank, ['money', 'printMoney']);\n\nvar steve = new Thief();\n\nalert(steve.money); // alerts '$$$'\nsteve.printMoney(); // alerts '$$$$$$$'\n
\nThe class to borrow members from
\nThe names of the members to borrow
\nthis
\nCreate a new instance of this Class.
\n\nExt.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.create({\n someConfig: true\n});\n
\n\nAll parameters are passed to the constructor of the class.
\nthe created instance.
\nCreate aliases for existing prototype methods. Example:
\n\nExt.define('My.cool.Class', {\n method1: function() { ... },\n method2: function() { ... }\n});\n\nvar test = new My.cool.Class();\n\nMy.cool.Class.createAlias({\n method3: 'method1',\n method4: 'method2'\n});\n\ntest.method3(); // test.method1()\n\nMy.cool.Class.createAlias('method5', 'method3');\n\ntest.method5(); // test.method3() -> test.method1()\n
\nThe new method name, or an object to set multiple aliases. See\nflexSetter
\nThe original method name
\nGet the current class' name in string format.
\n\nExt.define('My.cool.Class', {\n constructor: function() {\n alert(this.self.getName()); // alerts 'My.cool.Class'\n }\n});\n\nMy.cool.Class.getName(); // 'My.cool.Class'\n
\nclassName
\nAdd methods / properties to the prototype of this class.
\n\nExt.define('My.awesome.Cat', {\n constructor: function() {\n ...\n }\n});\n\n My.awesome.Cat.implement({\n meow: function() {\n alert('Meowww...');\n }\n });\n\n var kitty = new My.awesome.Cat;\n kitty.meow();\n
\nOverride prototype members of this class. Overridden methods can be invoked via\ncallOverridden
\n\nExt.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n\n return this;\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n var instance = this.callOverridden();\n\n alert(\"Meeeeoooowwww\");\n\n return instance;\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n
\nthis
\n