For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

## Sencha Documentation

# Ext.data.Types

This is s static class containing the system-supplied data types which may be given to a Field.

The properties in this class are used as type indicators in the Field class, so to test whether a Field is of a certain type, compare the type property against properties of this class.

Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE. each type definition must contain three properties:

- `convert` : Function
  A function to convert raw data values from a data block into the data to be stored in the Field. The function is passed the collowing parameters:
  - v : Mixed
    The data value as read by the Reader, if undefined will use the configured `defaultValue`.
  - rec : Mixed
    The data object containing the row as read by the Reader. Depending on the Reader type, this could be an Array (ArrayReader), an object (JsonReader), or an XML element.
- `sortType` : Function
  A function to convert the stored data into comparable form, as defined by Ext.data.SortTypes.
- `type` : String
  A textual data type name.

For example, to create a VELatLong field (See the Microsoft Bing Mapping API) containing the latitude/longitude value of a datapoint on a map from a JsonReader data block which contained the properties `lat` and `long`, you would define a new data type like this:

    // Add a new Field data type which stores a VELatLong object in the Record.
    Ext.data.Types.VELATLONG = {
        convert: function(v, data) {
            return new VELatLong(data.lat, data.long);
        },
        sortType: function(v) {
            return v.Latitude;  // When sorting, order by latitude
        },
        type: 'VELatLong'
    };

Then, when declaring a Model, use

    var types = Ext.data.Types; // allow shorthand type access
    Ext.define('Unit',
        extend: 'Ext.data.Model',
        fields: [
            { name: 'unitName', mapping: 'UnitName' },
            { name: 'curSpeed', mapping: 'CurSpeed', type: types.INT },
            { name: 'latitude', mapping: 'lat', type: types.FLOAT },
            { name: 'latitude', mapping: 'lat', type: types.FLOAT },
            { name: 'position', type: types.VELATLONG }
        ]
    });

Defined By

### Properties

Ext.data.Types
view source
AUTO : Object.

This data type means that no conversion is applied to the raw data before it is placed into a Record.

This data type means that no conversion is applied to the raw data before it is placed into a Record.

Ext.data.Types
view source
BOOL : Object.
This data type means that the raw data is converted into a boolean before it is placed into a Record. The string "tru...

This data type means that the raw data is converted into a boolean before it is placed into a Record. The string "true" and the number 1 are converted to boolean `true`.

The synonym `BOOLEAN` is equivalent.

Ext.data.Types
view source
BOOLEAN : Object.
This data type means that the raw data is converted into a boolean before it is placed into a Record. The string "tru...

This data type means that the raw data is converted into a boolean before it is placed into a Record. The string "true" and the number 1 are converted to boolean `true`.

The synonym `BOOL` is equivalent.

Ext.data.Types
view source
DATE : Object.
This data type means that the raw data is converted into a Date before it is placed into a Record. The date format is...

This data type means that the raw data is converted into a Date before it is placed into a Record. The date format is specified in the constructor of the Ext.data.Field to which this type is being applied.

Ext.data.Types
view source
FLOAT : Object.
This data type means that the raw data is converted into a number before it is placed into a Record. The synonym NUM...

This data type means that the raw data is converted into a number before it is placed into a Record.

The synonym `NUMBER` is equivalent.

Ext.data.Types
view source
INT : Object.
This data type means that the raw data is converted into an integer before it is placed into a Record. The synonym I...

This data type means that the raw data is converted into an integer before it is placed into a Record.

The synonym `INTEGER` is equivalent.

Ext.data.Types
view source
INTEGER : Object.
This data type means that the raw data is converted into an integer before it is placed into a Record. The synonym I...

This data type means that the raw data is converted into an integer before it is placed into a Record.

The synonym `INT` is equivalent.

Ext.data.Types
view source
NUMBER : Object.
This data type means that the raw data is converted into a number before it is placed into a Record. The synonym FLO...

This data type means that the raw data is converted into a number before it is placed into a Record.

The synonym `FLOAT` is equivalent.

Ext.data.Types
view source
STRING : Object.

This data type means that the raw data is converted into a String before it is placed into a Record.

This data type means that the raw data is converted into a String before it is placed into a Record.

Ext.data.Types
view source
stripRe : Regexp
A regular expression for stripping non-numeric characters from a numeric value. Defaults to /[\$,%]/g. This should be...

A regular expression for stripping non-numeric characters from a numeric value. Defaults to `/[\$,%]/g`. This should be overridden for localization.