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

Developers 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
Defined By

Config options

Ext.data.Field
view source
: Boolean
(Optional) Used for validating a record, defaults to true. ...

(Optional) Used for validating a record, defaults to true.\nAn empty value here will cause Ext.data.Record.isValid\nto evaluate to false.

\n

Defaults to: true

(Optional) A function which converts the value provided by the Reader into an object that will be stored\nin the Record. ...

(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:

    \n
  • v : Mixed
    The data value as read by the Reader, if undefined will use\nthe configured defaultValue.
  • \n
  • rec : Mixed
    The data object containing the row as read by the Reader.\nDepending on the Reader type, this could be an Array (ArrayReader), an object\n (JsonReader), or an XML element (XMLReader).
  • \n

\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\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\". ...

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

\n\n\n

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
Ext.data.Field
view source
: Mixed
(Optional) The default value used when a Record is being created by a Reader\nwhen the item referenced by the mapping ...

(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 \"\")

\n

Defaults to: ""

(Optional) A path expression for use by the Ext.data.DataReader implementation\nthat is creating the Record to extract...

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

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

\n\n\n
    \n
  • Ext.data.JsonReader
    The mapping is a string containing the javascript\nexpression to reference the data from an element of the data item's root Array. Defaults to the field name.
  • \n
  • Ext.data.XmlReader
    The mapping is an Ext.DomQuery path to the data\nitem relative to the DOM element that represents the record. Defaults to the field name.
  • \n
  • Ext.data.ArrayReader
    The mapping is a number indicating the Array index\nof the field's value. Defaults to the field specification's Array 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\n
Ext.data.Field
view source
: String
The name by which the field is referenced within the Record. ...

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

\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
Ext.data.Field
view source
: String
(Optional) Initial direction to sort (\"ASC\" or \"DESC\"). ...

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

\n

Defaults to: "ASC"

(Optional) A function which converts a Field's value to a comparable value in order to ensure\ncorrect sort ordering. ...

(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
Ext.data.Field
view source
: Mixed
(Optional) The data type for automatic conversion from received data to the stored value if convert\nhas not been spec...

(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
  • auto (Default, implies no conversion)
  • \n
  • string
  • \n
  • int
  • \n
  • float
  • \n
  • boolean
  • \n
  • date
\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
Ext.data.Field
view source
: Boolean
(Optional) Use when converting received data into a Number type (either int or float). ...

(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

Defined By

Methods

Ext.data.Field
view source
new( config ) : Ext.data.Field
...
\n

Parameters

  • config : Object
    \n

Returns

","superclasses":[],"meta":{},"requires":[],"html_meta":{},"statics":{"property":[],"cfg":[],"css_var":[],"method":[],"event":[],"css_mixin":[]},"files":[{"href":"DataField.html#Ext-data-Field","filename":"DataField.js"}],"linenr":1,"members":{"property":[],"cfg":[{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"allowBlank","id":"cfg-allowBlank"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"convert","id":"cfg-convert"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"dateFormat","id":"cfg-dateFormat"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"defaultValue","id":"cfg-defaultValue"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"mapping","id":"cfg-mapping"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"name","id":"cfg-name"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"sortDir","id":"cfg-sortDir"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"sortType","id":"cfg-sortType"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"type","id":"cfg-type"},{"tagname":"cfg","owner":"Ext.data.Field","meta":{},"name":"useNull","id":"cfg-useNull"}],"css_var":[],"method":[{"tagname":"method","owner":"Ext.data.Field","meta":{},"name":"constructor","id":"method-constructor"}],"event":[],"css_mixin":[]},"inheritable":null,"private":null,"component":false,"name":"Ext.data.Field","singleton":false,"override":null,"inheritdoc":null,"id":"class-Ext.data.Field","mixins":[],"mixedInto":[]});