/* This file is part of Ext JS 3.4 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. Build date: 2013-04-03 15:07:25 */ Ext.data.JsonP.Ext_data_Field({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"
Files
This class encapsulates the field definition information specified in the field definition objects\npassed to Ext.data.Record.create.
\n\n\nDevelopers do not need to instantiate this class. Instances are created by Ext.data.Record.create\nand cached in the fields property of the created Record constructor's prototype.
\n\n(Optional) Used for validating a record, defaults to true
.\nAn empty value here will cause Ext.data.Record.isValid\nto evaluate to false
.
Defaults to: true
(Optional) A function which converts the value provided by the Reader into an object that will be stored\nin the Record. It is passed the following parameters:
defaultValue
.// 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\nvar Dude = Ext.data.Record.create([\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// create the data store\nvar store = new Ext.data.Store({\n reader: new Ext.data.JsonReader(\n {\n idProperty: 'key',\n root: 'daRoot',\n totalProperty: 'total'\n },\n Dude // recordType\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(Optional) Used when converting received data into a Date when the type is specified as \"date\"
.
A format string for the Date.parseDate 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 Date
\n\n(Optional) The default value used when a Record 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 \"\")
Defaults to: ""
(Optional) A path expression for use by the Ext.data.DataReader implementation\nthat is creating the Record 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\nThe form of the mapping expression depends on the Reader being used.
\n\n\nIf 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\nThe name by which the field is referenced within the Record. This is referenced by, for example,\nthe dataIndex
property in column definition objects passed to Ext.grid.ColumnModel.
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.
(Optional) Initial direction to sort (\"ASC\"
or \"DESC\"
). Defaults to\n\"ASC\"
.
Defaults to: "ASC"
(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(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
This may also be specified by referencing a member of the Ext.data.Types class.
\n\n\nDevelopers may create their own application-specific data types by defining new members of the\nExt.data.Types class.
\n\n(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
Defaults to: false