X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6746dc89c47ed01b165cc1152533605f97eb8e8d..HEAD:/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 94c53112..c5112aba 100644 --- a/docs/output/Ext.data.reader.Reader.js +++ b/docs/output/Ext.data.reader.Reader.js @@ -1,290 +1 @@ -Ext.data.JsonP.Ext_data_reader_Reader({ - "allMixins": [ - - ], - "deprecated": null, - "docauthor": null, - "members": { - "cfg": [ - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Reader.html#Ext-data-reader-Reader-cfg-idProperty", - "shortDoc": "Name of the property within a row object\nthat contains a record identifier value. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "idProperty", - "owner": "Ext.data.reader.Reader", - "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", - "linenr": 151, - "html_filename": "Reader.html" - }, - { - "type": "Boolean", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Reader.html#Ext-data-reader-Reader-cfg-implicitIncludes", - "shortDoc": "True to automatically parse models nested within other models in a response\nobject. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "implicitIncludes", - "owner": "Ext.data.reader.Reader", - "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", - "linenr": 188, - "html_filename": "Reader.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Reader.html#Ext-data-reader-Reader-cfg-messageProperty", - "shortDoc": "The name of the property which contains a response message. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "messageProperty", - "owner": "Ext.data.reader.Reader", - "doc": "

The name of the property which contains a response message.\nThis property is optional.

\n", - "linenr": 183, - "html_filename": "Reader.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Reader.html#Ext-data-reader-Reader-cfg-root", - "shortDoc": "Required. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "root", - "owner": "Ext.data.reader.Reader", - "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", - "linenr": 174, - "html_filename": "Reader.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Reader.html#Ext-data-reader-Reader-cfg-successProperty", - "shortDoc": "Name of the property from which to\nretrieve the success attribute. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "successProperty", - "owner": "Ext.data.reader.Reader", - "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", - "linenr": 166, - "html_filename": "Reader.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "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. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "totalProperty", - "owner": "Ext.data.reader.Reader", - "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", - "linenr": 158, - "html_filename": "Reader.html" - } - ], - "method": [ - { - "deprecated": null, - "alias": null, - "href": "Reader.html#Ext-data-reader-Reader-method-constructor", - "tagname": "method", - "protected": false, - "shortDoc": "Creates new Reader. ...", - "static": false, - "params": [ - { - "type": "Object", - "optional": true, - "doc": "

(optional) Config object.

\n", - "name": "config" - } - ], - "private": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "doc": "

Creates new Reader.

\n", - "owner": "Ext.data.reader.Reader", - "name": "Reader", - "html_filename": "Reader.html", - "return": { - "type": "Object", - "doc": "\n" - }, - "linenr": 196 - }, - { - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "method", - "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. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "params": [ - { - "type": "Object", - "optional": false, - "doc": "

The responce object

\n", - "name": "response" - } - ], - "name": "getResponseData", - "owner": "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", - "linenr": 460, - "return": { - "type": "Object", - "doc": "

The useful data from the response

\n" - }, - "html_filename": "Reader.html" - }, - { - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "method", - "href": "Reader.html#Ext-data-reader-Reader-method-read", - "shortDoc": "Reads the given response object. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "params": [ - { - "type": "Object", - "optional": false, - "doc": "

The response object. This may be either an XMLHttpRequest object or a plain JS object

\n", - "name": "response" - } - ], - "name": "read", - "owner": "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", - "linenr": 228, - "return": { - "type": "Ext.data.ResultSet", - "doc": "

The parsed ResultSet object

\n" - }, - "html_filename": "Reader.html" - }, - { - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "method", - "href": "Reader.html#Ext-data-reader-Reader-method-readRecords", - "shortDoc": "Abstracts common functionality used by all Reader subclasses. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "params": [ - { - "type": "Mixed", - "optional": false, - "doc": "

The raw data object

\n", - "name": "data" - } - ], - "name": "readRecords", - "owner": "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", - "linenr": 248, - "return": { - "type": "Ext.data.ResultSet", - "doc": "

A ResultSet object

\n" - }, - "html_filename": "Reader.html" - } - ], - "property": [ - { - "type": "Mixed", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "property", - "href": "Reader.html#Ext-data-reader-Reader-property-rawData", - "shortDoc": "The raw data object that was last passed to readRecords. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "name": "rawData", - "owner": "Ext.data.reader.Reader", - "doc": "

The raw data object that was last passed to readRecords. Stored for further processing if needed

\n", - "linenr": 268, - "html_filename": "Reader.html" - } - ], - "cssVar": [ - - ], - "cssMixin": [ - - ], - "event": [ - - ] - }, - "singleton": false, - "alias": null, - "superclasses": [ - - ], - "protected": false, - "tagname": "class", - "mixins": [ - - ], - "href": "Reader.html#Ext-data-reader-Reader", - "subclasses": [ - "Ext.data.reader.Xml", - "Ext.data.reader.Json" - ], - "static": false, - "author": "Ed Spencer", - "component": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js", - "private": false, - "alternateClassNames": [ - "Ext.data.Reader", - "Ext.data.DataReader" - ], - "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\n

Loading Nested Data

\n\n\n\n\n

Readers 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\n

This 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\n

The 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\n

Running the code above results in the following:

\n\n
Orders for Ed:\nOrder ID: 50, which contains items:\n2 orders of MacBook Pro\n3 orders of iPhone\n
\n\n", - "mixedInto": [ - - ], - "linenr": 1, - "xtypes": [ - - ], - "html_filename": "Reader.html", - "extends": "Object" -}); \ No newline at end of file +Ext.data.JsonP.Ext_data_reader_Reader({"tagname":"class","html":"

Alternate names

Ext.data.Reader
Ext.data.DataReader

Hierarchy

Ext.Base
Ext.data.reader.Reader

Requires

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\n
Ext.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\n

The 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\n

Loading Nested Data

\n\n

Readers 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\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\n

This 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\n

The 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\n
var 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\n

Running the code above results in the following:

\n\n
Orders for Ed:\nOrder ID: 50, which contains items:\n2 orders of MacBook Pro\n3 orders of iPhone\n
\n
Defined By

Config options

Name of the property within a row object that contains a record identifier value. ...

Name 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

\n
True to automatically parse models nested within other models in a response object. ...

True 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.

\n

Defaults to: true

The name of the property which contains a response message. ...

The name of the property which contains a response message. This property is optional.

\n
The name of the property which contains the Array of row objects. ...

The 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\n

By default the natural root of the data will be used. The root Json array, the root XML element, or the array.

\n\n

The data packet value for this property should be an empty array to clear the data or show no data.

\n

Defaults to: ""

Name of the property from which to retrieve the success attribute. ...

Name of the property from which to retrieve the success attribute. Defaults to success. See\nExt.data.proxy.Server.exception for additional information.

\n

Defaults to: "success"

Name of the property from which to retrieve the total number of records in the dataset. ...

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.

\n

Defaults to: "total"

Defined By

Properties

The raw data object that was last passed to readRecords. ...

The raw data object that was last passed to readRecords. Stored for further processing if needed

\n
Get the reference to the current class from which this object was instantiated. ...

Get 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

\n\n
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
\n

Methods

Defined By

Instance Methods

Creates new Reader. ...

Creates new Reader.

\n

Parameters

  • config : Object (optional)

    Config object.

    \n

Returns

( Array/Arguments args ) : Objectprotected
Call the original method that was previously overridden with override\n\nExt.define('My.Cat', {\n constructor: functi...

Call the original method that was previously overridden with override

\n\n
Ext.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
\n

Parameters

  • args : Array/Arguments

    The arguments, either an array or the arguments object

    \n

Returns

  • Object

    Returns the result after calling the overridden method

    \n
( Array/Arguments args ) : Objectprotected
Call the parent's overridden method. ...

Call the parent's overridden method. For example:

\n\n
Ext.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
\n

Parameters

  • args : Array/Arguments

    The arguments, either an array or the arguments object\nfrom the current method, for example: this.callParent(arguments)

    \n

Returns

  • Object

    Returns the result from the superclass' method

    \n
Takes a raw response object (as passed to this.read) and returns the useful data segment of it. ...

Takes a raw response object (as passed to this.read) and returns the useful data segment of it. This must be\nimplemented by each subclass

\n

Parameters

  • response : Object

    The responce object

    \n

Returns

  • Object

    The useful data from the response

    \n
Initialize configuration for this class. ...

Initialize configuration for this class. a typical example:

\n\n
Ext.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
\n

Parameters

Returns

  • Object

    mixins The mixin prototypes as key - value pairs

    \n
Reads the given response object. ...

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

Parameters

  • response : Object

    The response object. This may be either an XMLHttpRequest object or a plain JS object

    \n

Returns

Abstracts common functionality used by all Reader subclasses. ...

Abstracts 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.

\n

Parameters

  • data : Object

    The raw data object

    \n

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,\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

\n\n
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
\n

Returns

Defined By

Static Methods

Add / override static properties of this class. ...

Add / override static properties of this class.

\n\n
Ext.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
\n

Parameters

Returns

( Ext.Base fromClass, String/String[] members ) : Ext.Basestatic
Borrow another class' members to the prototype of this class. ...

Borrow another class' members to the prototype of this class.

\n\n
Ext.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
\n

Parameters

  • fromClass : Ext.Base

    The class to borrow members from

    \n
  • members : String/String[]

    The names of the members to borrow

    \n

Returns

Create a new instance of this Class. ...

Create a new instance of this Class.

\n\n
Ext.define('My.cool.Class', {\n    ...\n});\n\nMy.cool.Class.create({\n    someConfig: true\n});\n
\n\n

All parameters are passed to the constructor of the class.

\n

Returns

Create aliases for existing prototype methods. ...

Create aliases for existing prototype methods. Example:

\n\n
Ext.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
\n

Parameters

Get the current class' name in string format. ...

Get the current class' name in string format.

\n\n
Ext.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
\n

Returns

Add methods / properties to the prototype of this class. ...

Add methods / properties to the prototype of this class.

\n\n
Ext.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
\n

Parameters

Override prototype members of this class. ...

Override prototype members of this class. Overridden methods can be invoked via\ncallOverridden

\n\n
Ext.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
\n

Parameters

Returns

","allMixins":[],"meta":{"author":["Ed Spencer"]},"requires":["Ext.data.ResultSet"],"deprecated":null,"extends":"Ext.Base","inheritable":false,"static":false,"superclasses":["Ext.Base","Ext.data.reader.Reader"],"singleton":false,"code_type":"ext_define","alias":null,"statics":{"property":[],"css_var":[],"css_mixin":[],"cfg":[],"method":[{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"addStatics","id":"static-method-addStatics"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"borrow","id":"static-method-borrow"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"create","id":"static-method-create"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"createAlias","id":"static-method-createAlias"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"getName","id":"static-method-getName"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"implement","id":"static-method-implement"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"override","id":"static-method-override"}],"event":[]},"subclasses":["Ext.data.reader.Json","Ext.data.reader.Xml"],"uses":[],"protected":false,"mixins":[],"members":{"property":[{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":null,"protected":false,"name":"rawData","id":"property-rawData"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.Base","template":null,"required":null,"protected":true,"name":"self","id":"property-self"}],"css_var":[],"css_mixin":[],"cfg":[{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":false,"protected":false,"name":"idProperty","id":"cfg-idProperty"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":false,"protected":false,"name":"implicitIncludes","id":"cfg-implicitIncludes"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":false,"protected":false,"name":"messageProperty","id":"cfg-messageProperty"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":false,"protected":false,"name":"root","id":"cfg-root"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":false,"protected":false,"name":"successProperty","id":"cfg-successProperty"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":null,"required":false,"protected":false,"name":"totalProperty","id":"cfg-totalProperty"}],"method":[{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":false,"required":null,"protected":false,"name":"constructor","id":"method-constructor"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"callOverridden","id":"method-callOverridden"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"callParent","id":"method-callParent"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":false,"required":null,"protected":false,"name":"getResponseData","id":"method-getResponseData"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"initConfig","id":"method-initConfig"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":false,"required":null,"protected":false,"name":"read","id":"method-read"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.data.reader.Reader","template":false,"required":null,"protected":false,"name":"readRecords","id":"method-readRecords"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"statics","id":"method-statics"}],"event":[]},"private":false,"component":false,"name":"Ext.data.reader.Reader","alternateClassNames":["Ext.data.Reader","Ext.data.DataReader"],"id":"class-Ext.data.reader.Reader","mixedInto":[],"xtypes":{},"files":[{"href":"Reader.html#Ext-data-reader-Reader","filename":"Reader.js"}]}); \ No newline at end of file