X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6746dc89c47ed01b165cc1152533605f97eb8e8d..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/docs/output/Ext.data.Field.js diff --git a/docs/output/Ext.data.Field.js b/docs/output/Ext.data.Field.js index 3a82d484..055f3ffb 100644 --- a/docs/output/Ext.data.Field.js +++ b/docs/output/Ext.data.Field.js @@ -1,229 +1 @@ -Ext.data.JsonP.Ext_data_Field({ - "allMixins": [ - - ], - "deprecated": null, - "docauthor": null, - "members": { - "cfg": [ - { - "type": "Function", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-convert", - "shortDoc": "(Optional) A function which converts the value provided by the Reader into an object that will be stored\nin the Model. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "convert", - "owner": "Ext.data.Field", - "doc": "

(Optional) A function which converts the value provided by the Reader into an object that will be stored\nin the Model. It is passed the following parameters:

\n\n
// example of convert function\nfunction fullName(v, record){\n    return record.name.last + ', ' + record.name.first;\n}\n\nfunction location(v, record){\n    return !record.city ? '' : (record.city + ', ' + record.state);\n}\n\nExt.define('Dude', {\n    extend: 'Ext.data.Model',\n    fields: [\n        {name: 'fullname',  convert: fullName},\n        {name: 'firstname', mapping: 'name.first'},\n        {name: 'lastname',  mapping: 'name.last'},\n        {name: 'city', defaultValue: 'homeless'},\n        'state',\n        {name: 'location',  convert: location}\n    ]\n});\n\n// create the data store\nvar store = new Ext.data.Store({\n    reader: {\n        type: 'json',\n        model: 'Dude',\n        idProperty: 'key',\n        root: 'daRoot',\n        totalProperty: 'total'\n    }\n});\n\nvar myData = [\n    { key: 1,\n      name: { first: 'Fat',    last:  'Albert' }\n      // notice no city, state provided in data object\n    },\n    { key: 2,\n      name: { first: 'Barney', last:  'Rubble' },\n      city: 'Bedrock', state: 'Stoneridge'\n    },\n    { key: 3,\n      name: { first: 'Cliff',  last:  'Claven' },\n      city: 'Boston',  state: 'MA'\n    }\n];\n
\n\n", - "linenr": 162, - "html_filename": "Field3.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-dateFormat", - "shortDoc": "(Optional) Used when converting received data into a Date when the type is specified as \"date\". ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "dateFormat", - "owner": "Ext.data.Field", - "doc": "

(Optional) Used when converting received data into a Date when the type is specified as \"date\".

\n\n\n

A format string for the Ext.Date.parse function, or \"timestamp\" if the\nvalue provided by the Reader is a UNIX timestamp, or \"time\" if the value provided by the Reader is a\njavascript millisecond timestamp. See Ext.Date

\n\n", - "linenr": 221, - "html_filename": "Field3.html" - }, - { - "type": "Mixed", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-defaultValue", - "shortDoc": "(Optional) The default value used when a Model is being created by a Reader\nwhen the item referenced by the mapping d...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "defaultValue", - "owner": "Ext.data.Field", - "doc": "

(Optional) The default value used when a Model is being created by a Reader\nwhen the item referenced by the mapping does not exist in the data\nobject (i.e. undefined). (defaults to \"\")

\n", - "linenr": 237, - "html_filename": "Field3.html" - }, - { - "type": "String/Number", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-mapping", - "shortDoc": "(Optional) A path expression for use by the Ext.data.reader.Reader implementation\nthat is creating the Model to extra...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "mapping", - "owner": "Ext.data.Field", - "doc": "

(Optional) A path expression for use by the Ext.data.reader.Reader implementation\nthat is creating the Model to extract the Field value from the data object.\nIf the path expression is the same as the field name, the mapping may be omitted.

\n\n\n

The form of the mapping expression depends on the Reader being used.

\n\n\n
\n\n\n

If a more complex value extraction strategy is required, then configure the Field with a convert\nfunction. This is passed the whole row object, and may interrogate it in whatever way is necessary in order to\nreturn the desired data.

\n\n", - "linenr": 244, - "html_filename": "Field3.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-name", - "shortDoc": "The name by which the field is referenced within the Model. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "name", - "owner": "Ext.data.Field", - "doc": "

The name by which the field is referenced within the Model. This is referenced by, for example,\nthe dataIndex property in column definition objects passed to Ext.grid.property.HeaderContainer.

\n\n

Note: In the simplest case, if no properties other than name are required, a field\ndefinition may consist of just a String for the field name.

\n\n", - "linenr": 138, - "html_filename": "Field3.html" - }, - { - "type": "Boolean", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-persist", - "shortDoc": "False to exclude this field from the Ext.data.Model.modified fields in a model. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "persist", - "owner": "Ext.data.Field", - "doc": "

False to exclude this field from the Ext.data.Model.modified fields in a model. This\nwill also exclude the field from being written using a Ext.data.writer.Writer. This option\nis useful when model fields are used to keep state on the client but do not need to be persisted\nto the server. Defaults to true.

\n", - "linenr": 301, - "html_filename": "Field3.html" - }, - { - "type": "String", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-sortDir", - "shortDoc": "(Optional) Initial direction to sort (\"ASC\" or \"DESC\"). ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "sortDir", - "owner": "Ext.data.Field", - "doc": "

(Optional) Initial direction to sort (\"ASC\" or \"DESC\"). Defaults to\n\"ASC\".

\n", - "linenr": 286, - "html_filename": "Field3.html" - }, - { - "type": "Function", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-sortType", - "shortDoc": "(Optional) A function which converts a Field's value to a comparable value in order to ensure\ncorrect sort ordering. ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "sortType", - "owner": "Ext.data.Field", - "doc": "

(Optional) A function which converts a Field's value to a comparable value in order to ensure\ncorrect sort ordering. Predefined functions are provided in Ext.data.SortTypes. A custom\nsort example:

\n\n
// current sort     after sort we want\n// +-+------+          +-+------+\n// |1|First |          |1|First |\n// |2|Last  |          |3|Second|\n// |3|Second|          |2|Last  |\n// +-+------+          +-+------+\n\nsortType: function(value) {\n   switch (value.toLowerCase()) // native toLowerCase():\n   {\n      case 'first': return 1;\n      case 'second': return 2;\n      default: return 3;\n   }\n}\n
\n\n", - "linenr": 263, - "html_filename": "Field3.html" - }, - { - "type": "Mixed", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-type", - "shortDoc": "(Optional) The data type for automatic conversion from received data to the stored value if convert\nhas not been spec...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "type", - "owner": "Ext.data.Field", - "doc": "

(Optional) The data type for automatic conversion from received data to the stored value if convert\nhas not been specified. This may be specified as a string value. Possible values are

\n\n
\n\n\n

This may also be specified by referencing a member of the Ext.data.Types class.

\n\n\n

Developers may create their own application-specific data types by defining new members of the\nExt.data.Types class.

\n\n", - "linenr": 146, - "html_filename": "Field3.html" - }, - { - "type": "Boolean", - "deprecated": null, - "alias": null, - "protected": false, - "tagname": "cfg", - "href": "Field3.html#Ext-data-Field-cfg-useNull", - "shortDoc": "(Optional) Use when converting received data into a Number type (either int or float). ...", - "static": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "name": "useNull", - "owner": "Ext.data.Field", - "doc": "

(Optional) Use when converting received data into a Number type (either int or float). If the value cannot be parsed,\nnull will be used if useNull is true, otherwise the value will be 0. Defaults to false\n\n", - "linenr": 230, - "html_filename": "Field3.html" - } - ], - "method": [ - - ], - "property": [ - - ], - "cssVar": [ - - ], - "cssMixin": [ - - ], - "event": [ - - ] - }, - "singleton": false, - "alias": null, - "superclasses": [ - - ], - "protected": false, - "tagname": "class", - "mixins": [ - - ], - "href": "Field3.html#Ext-data-Field", - "subclasses": [ - - ], - "static": false, - "author": "Ed Spencer", - "component": false, - "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/Field.js", - "private": false, - "alternateClassNames": [ - - ], - "name": "Ext.data.Field", - "doc": "

Fields are used to define what a Model is. They aren't instantiated directly - instead, when we create a class \nthat extends Ext.data.Model, it will automatically create a Field instance for each field configured in a \nModel. For example, we might set up a model like this:

\n\n\n\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: [\n        'name', 'email',\n        {name: 'age', type: 'int'},\n        {name: 'gender', type: 'string', defaultValue: 'Unknown'}\n    ]\n});\n
\n\n\n\n\n

Four fields will have been created for the User Model - name, email, age and gender. Note that we specified a\ncouple of different formats here; if we only pass in the string name of the field (as with name and email), the\nfield is set up with the 'auto' type. It's as if we'd done this instead:

\n\n\n\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: [\n        {name: 'name', type: 'auto'},\n        {name: 'email', type: 'auto'},\n        {name: 'age', type: 'int'},\n        {name: 'gender', type: 'string', defaultValue: 'Unknown'}\n    ]\n});\n
\n\n\n\n\n

Types and conversion

\n\n\n\n\n

The type is important - it's used to automatically convert data passed to the field into the correct\nformat. In our example above, the name and email fields used the 'auto' type and will just accept anything that is\npassed into them. The 'age' field had an 'int' type however, so if we passed 25.4 this would be rounded to 25.

\n\n\n\n\n

Sometimes a simple type isn't enough, or we want to perform some processing when we load a Field's data. We can\ndo this using a convert function. Here, we're going to create a new field based on another:

\n\n\n

\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: [\n        'name', 'email',\n        {name: 'age', type: 'int'},\n        {name: 'gender', type: 'string', defaultValue: 'Unknown'},\n\n        {\n            name: 'firstName',\n            convert: function(value, record) {\n                var fullName  = record.get('name'),\n                    splits    = fullName.split(\" \"),\n                    firstName = splits[0];\n\n                return firstName;\n            }\n        }\n    ]\n});\n
\n\n\n\n\n

Now when we create a new User, the firstName is populated automatically based on the name:

\n\n\n

\n\n
var ed = Ext.ModelManager.create({name: 'Ed Spencer'}, 'User');\n\nconsole.log(ed.get('firstName')); //logs 'Ed', based on our convert function\n
\n\n\n\n\n

In fact, if we log out all of the data inside ed, we'll see this:

\n\n\n

\n\n
console.log(ed.data);\n\n//outputs this:\n{\n    age: 0,\n    email: \"\",\n    firstName: \"Ed\",\n    gender: \"Unknown\",\n    name: \"Ed Spencer\"\n}\n
\n\n\n\n\n

The age field has been given a default of zero because we made it an int type. As an auto field, email has\ndefaulted to an empty string. When we registered the User model we set gender's defaultValue to 'Unknown'\nso we see that now. Let's correct that and satisfy ourselves that the types work as we expect:

\n\n\n

\n\n
ed.set('gender', 'Male');\ned.get('gender'); //returns 'Male'\n\ned.set('age', 25.4);\ned.get('age'); //returns 25 - we wanted an int, not a float, so no decimal places allowed\n
\n\n", - "mixedInto": [ - - ], - "linenr": 1, - "xtypes": [ - - ], - "html_filename": "Field3.html", - "extends": "Object" -}); \ No newline at end of file +Ext.data.JsonP.Ext_data_Field({"tagname":"class","html":"

Hierarchy

Ext.Base
Ext.data.Field

Requires

Files

Fields are used to define what a Model is. They aren't instantiated directly - instead, when we create a class that\nextends Ext.data.Model, it will automatically create a Field instance for each field configured in a Model. For example, we might set up a model like this:

\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: [\n        'name', 'email',\n        {name: 'age', type: 'int'},\n        {name: 'gender', type: 'string', defaultValue: 'Unknown'}\n    ]\n});\n
\n\n

Four fields will have been created for the User Model - name, email, age and gender. Note that we specified a couple\nof different formats here; if we only pass in the string name of the field (as with name and email), the field is set\nup with the 'auto' type. It's as if we'd done this instead:

\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: [\n        {name: 'name', type: 'auto'},\n        {name: 'email', type: 'auto'},\n        {name: 'age', type: 'int'},\n        {name: 'gender', type: 'string', defaultValue: 'Unknown'}\n    ]\n});\n
\n\n

Types and conversion

\n\n

The type is important - it's used to automatically convert data passed to the field into the correct format.\nIn our example above, the name and email fields used the 'auto' type and will just accept anything that is passed\ninto them. The 'age' field had an 'int' type however, so if we passed 25.4 this would be rounded to 25.

\n\n

Sometimes a simple type isn't enough, or we want to perform some processing when we load a Field's data. We can do\nthis using a convert function. Here, we're going to create a new field based on another:

\n\n
Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: [\n        'name', 'email',\n        {name: 'age', type: 'int'},\n        {name: 'gender', type: 'string', defaultValue: 'Unknown'},\n\n        {\n            name: 'firstName',\n            convert: function(value, record) {\n                var fullName  = record.get('name'),\n                    splits    = fullName.split(\" \"),\n                    firstName = splits[0];\n\n                return firstName;\n            }\n        }\n    ]\n});\n
\n\n

Now when we create a new User, the firstName is populated automatically based on the name:

\n\n
var ed = Ext.create('User', {name: 'Ed Spencer'});\n\nconsole.log(ed.get('firstName')); //logs 'Ed', based on our convert function\n
\n\n

In fact, if we log out all of the data inside ed, we'll see this:

\n\n
console.log(ed.data);\n\n//outputs this:\n{\n    age: 0,\n    email: \"\",\n    firstName: \"Ed\",\n    gender: \"Unknown\",\n    name: \"Ed Spencer\"\n}\n
\n\n

The age field has been given a default of zero because we made it an int type. As an auto field, email has defaulted\nto an empty string. When we registered the User model we set gender's defaultValue to 'Unknown' so we see\nthat now. Let's correct that and satisfy ourselves that the types work as we expect:

\n\n
ed.set('gender', 'Male');\ned.get('gender'); //returns 'Male'\n\ned.set('age', 25.4);\ned.get('age'); //returns 25 - we wanted an int, not a float, so no decimal places allowed\n
\n
Defined By

Config options

A function which converts the value provided by the Reader into an object that will be stored in the Model. ...

A function which converts the value provided by the Reader into an object that will be stored in the Model.\nIt is passed the following parameters:

\n\n
    \n
  • v : Mixed

    \n\n

    The data value as read by the Reader, if undefined will use the configured defaultValue.

  • \n
  • rec : Ext.data.Model

    \n\n

    The data object containing the Model as read so far by the Reader. Note that the Model may not be fully populated\nat this point as the fields are read in the order that they are defined in your\nfields array.

  • \n
\n\n\n

Example of convert functions:

\n\n
function fullName(v, record){\n    return record.name.last + ', ' + record.name.first;\n}\n\nfunction location(v, record){\n    return !record.city ? '' : (record.city + ', ' + record.state);\n}\n\nExt.define('Dude', {\n    extend: 'Ext.data.Model',\n    fields: [\n        {name: 'fullname',  convert: fullName},\n        {name: 'firstname', mapping: 'name.first'},\n        {name: 'lastname',  mapping: 'name.last'},\n        {name: 'city', defaultValue: 'homeless'},\n        'state',\n        {name: 'location',  convert: location}\n    ]\n});\n\n// create the data store\nvar store = Ext.create('Ext.data.Store', {\n    reader: {\n        type: 'json',\n        model: 'Dude',\n        idProperty: 'key',\n        root: 'daRoot',\n        totalProperty: 'total'\n    }\n});\n\nvar myData = [\n    { key: 1,\n      name: { first: 'Fat',    last:  'Albert' }\n      // notice no city, state provided in data object\n    },\n    { key: 2,\n      name: { first: 'Barney', last:  'Rubble' },\n      city: 'Bedrock', state: 'Stoneridge'\n    },\n    { key: 3,\n      name: { first: 'Cliff',  last:  'Claven' },\n      city: 'Boston',  state: 'MA'\n    }\n];\n
\n
Used when converting received data into a Date when the type is specified as \"date\". ...

Used when converting received data into a Date when the type is specified as \"date\".

\n\n

A format string for the Ext.Date.parse function, or \"timestamp\" if the value provided by\nthe Reader is a UNIX timestamp, or \"time\" if the value provided by the Reader is a javascript millisecond\ntimestamp. See Ext.Date.

\n

Defaults to: null

The default value used when a Model is being created by a Reader\nwhen the item referenced by the mapping does not exi...

The default value used when a Model is being created by a Reader\nwhen the item referenced by the mapping does not exist in the data object\n(i.e. undefined). Defaults to \"\".

\n

Defaults to: ""

(Optional) A path expression for use by the Ext.data.reader.Reader implementation that is creating the\nModel to extra...

(Optional) A path expression for use by the Ext.data.reader.Reader implementation that is creating the\nModel to extract the Field value from the data object. If the path expression is the same\nas the field name, the mapping may be omitted.

\n\n

The form of the mapping expression depends on the Reader being used.

\n\n
    \n
  • Ext.data.reader.Json

    \n\n

    The mapping is a string containing the javascript expression to reference the data from an element of the data\nitem's root Array. Defaults to the field name.

  • \n
  • Ext.data.reader.Xml

    \n\n

    The mapping is an Ext.DomQuery path to the data item relative to the DOM element that represents the\nrecord. Defaults to the field name.

  • \n
  • Ext.data.reader.Array

    \n\n

    The mapping is a number indicating the Array index of the field's value. Defaults to the field specification's\nArray position.

  • \n
\n\n\n

If a more complex value extraction strategy is required, then configure the Field with a convert\nfunction. This is passed the whole row object, and may interrogate it in whatever way is necessary in order to\nreturn the desired data.

\n

Defaults to: null

The name by which the field is referenced within the Model. ...

The name by which the field is referenced within the Model. This is referenced by, for example, the dataIndex\nproperty in column definition objects passed to Ext.grid.property.HeaderContainer.

\n\n

Note: In the simplest case, if no properties other than name are required, a field definition may consist of\njust a String for the field name.

\n
False to exclude this field from the Ext.data.Model.modified fields in a model. ...

False to exclude this field from the Ext.data.Model.modified fields in a model. This will also exclude\nthe field from being written using a Ext.data.writer.Writer. This option is useful when model fields are\nused to keep state on the client but do not need to be persisted to the server. Defaults to true.

\n

Defaults to: true

Initial direction to sort (\"ASC\" or \"DESC\"). ...

Initial direction to sort (\"ASC\" or \"DESC\"). Defaults to \"ASC\".

\n

Defaults to: "ASC"

A function which converts a Field's value to a comparable value in order to ensure correct sort ordering. ...

A function which converts a Field's value to a comparable value in order to ensure correct sort ordering.\nPredefined functions are provided in Ext.data.SortTypes. A custom sort example:

\n\n
// current sort     after sort we want\n// +-+------+          +-+------+\n// |1|First |          |1|First |\n// |2|Last  |          |3|Second|\n// |3|Second|          |2|Last  |\n// +-+------+          +-+------+\n\nsortType: function(value) {\n   switch (value.toLowerCase()) // native toLowerCase():\n   {\n      case 'first': return 1;\n      case 'second': return 2;\n      default: return 3;\n   }\n}\n
\n

Defaults to: null

The data type for automatic conversion from received data to the stored value if\nconvert has not been specified. ...

The data type for automatic conversion from received data to the stored value if\nconvert has not been specified. This may be specified as a string value.\nPossible values are

\n\n
    \n
  • auto (Default, implies no conversion)
  • \n
  • string
  • \n
  • int
  • \n
  • float
  • \n
  • boolean
  • \n
  • date
  • \n
\n\n\n

This may also be specified by referencing a member of the Ext.data.Types class.

\n\n

Developers may create their own application-specific data types by defining new members of the Ext.data.Types class.

\n
Use when converting received data into a Number type (either int or float). ...

Use when converting received data into a Number type (either int or float). If the value cannot be\nparsed, null will be used if useNull is true, otherwise the value will be 0. Defaults to false.

\n

Defaults to: false

Defined By

Properties

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

( 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
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
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.Types","Ext.data.SortTypes"],"deprecated":null,"extends":"Ext.Base","inheritable":false,"static":false,"superclasses":["Ext.Base","Ext.data.Field"],"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":[],"uses":[],"protected":false,"mixins":[],"members":{"property":[{"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.Field","template":null,"required":false,"protected":false,"name":"convert","id":"cfg-convert"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"dateFormat","id":"cfg-dateFormat"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"defaultValue","id":"cfg-defaultValue"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"mapping","id":"cfg-mapping"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"name","id":"cfg-name"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"persist","id":"cfg-persist"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"sortDir","id":"cfg-sortDir"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"sortType","id":"cfg-sortType"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"type","id":"cfg-type"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.data.Field","template":null,"required":false,"protected":false,"name":"useNull","id":"cfg-useNull"}],"method":[{"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.Base","template":false,"required":null,"protected":true,"name":"initConfig","id":"method-initConfig"},{"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.Field","alternateClassNames":[],"id":"class-Ext.data.Field","mixedInto":[],"xtypes":{"data":["field"]},"files":[{"href":"Field3.html#Ext-data-Field","filename":"Field.js"}]}); \ No newline at end of file