1 <div class="body-wrap" xmlns:ext="http://www.extjs.com"><div class="top-tools"><a class="inner-link" href="#Ext.data.Types-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a> <a class="inner-link" href="#Ext.data.Types-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a> <a class="inner-link" href="#Ext.data.Types-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a> <a class="bookmark" href="../docs/?class=Ext.data.Types"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a> </div><h1>Class <a href="source/Types.html#cls-Ext.data.Types">Ext.data.Types</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext.data</td></tr><tr><td class="label">Defined In:</td><td class="hd-info"><a href="source/Types.html#cls-Ext.data.Types">Types.js</a></td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/Types.html#cls-Ext.data.Types">Types</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr></table><div class="description"><p>This is s static class containing the system-supplied data types which may be given to a <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">Field</a>.<p/>
2 <p>The properties in this class are used as type indicators in the <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">Field</a> class, so to
3 test whether a Field is of a certain type, compare the <a href="output/Ext.data.Field.html#Ext.data.Field-type" ext:member="type" ext:cls="Ext.data.Field">type</a> property against properties
5 <p>Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE.
6 each type definition must contain three properties:</p>
7 <div class="mdetail-params"><ul>
8 <li><code>convert</code> : <i>Function</i><div class="sub-desc">A function to convert raw data values from a data block into the data
9 to be stored in the Field. The function is passed the collowing parameters:
10 <div class="mdetail-params"><ul>
11 <li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
12 the configured <tt><a href="output/Ext.data.Field.html#Ext.data.Field-defaultValue" ext:member="defaultValue" ext:cls="Ext.data.Field">defaultValue</a></tt>.</div></li>
13 <li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
14 Depending on the Reader type, this could be an Array (<a href="output/Ext.data.ArrayReader.html" ext:cls="Ext.data.ArrayReader">ArrayReader</a>), an object
15 (<a href="output/Ext.data.JsonReader.html" ext:cls="Ext.data.JsonReader">JsonReader</a>), or an XML element (<a href="output/Ext.data.XMLReader.html" ext:cls="Ext.data.XMLReader">XMLReader</a>).</div></li>
16 </ul></div></div></li>
17 <li><code>sortType</code> : <i>Function</i> <div class="sub-desc">A function to convert the stored data into comparable form, as defined by <a href="output/Ext.data.SortTypes.html" ext:cls="Ext.data.SortTypes">Ext.data.SortTypes</a>.</div></li>
18 <li><code>type</code> : <i>String</i> <div class="sub-desc">A textual data type name.</div></li>
20 <p>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
21 which contained the properties <code>lat</code> and <code>long</code>, you would define a new data type like this:</p>
22 <pre><code><i>// Add a <b>new</b> Field data type which stores a VELatLong object <b>in</b> the Record.</i>
23 Ext.data.Types.VELATLONG = {
24 convert: <b>function</b>(v, data) {
25 <b>return</b> <b>new</b> VELatLong(data.lat, data.long);
27 sortType: <b>function</b>(v) {
28 <b>return</b> v.Latitude; <i>// When sorting, order by latitude</i>
30 type: <em>'VELatLong'</em>
32 <p>Then, when declaring a Record, use <pre><code><b>var</b> types = Ext.data.Types; <i>// allow shorthand type access</i>
33 UnitRecord = Ext.data.Record.create([
34 { name: <em>'unitName'</em>, mapping: <em>'UnitName'</em> },
35 { name: <em>'curSpeed'</em>, mapping: <em>'CurSpeed'</em>, type: types.INT },
36 { name: <em>'latitude'</em>, mapping: <em>'lat'</em>, type: types.FLOAT },
37 { name: <em>'latitude'</em>, mapping: <em>'lat'</em>, type: types.FLOAT },
38 { name: <em>'position'</em>, type: types.VELATLONG }
39 ]);</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i></div><div class="hr"></div><a id="Ext.data.Types-props"></a><h2>Public Properties</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Property</th><th class="msource-header">Defined By</th></tr><tr class="property-row "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-AUTO"></a><b><a href="source/Types.html#prop-Ext.data.Types-AUTO">AUTO</a></b> : Object.<div class="mdesc">This data type means that no conversion is applied to the raw data before it is placed into a Record.</div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-BOOL"></a><b><a href="source/Types.html#prop-Ext.data.Types-BOOL">BOOL</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into a boolean before it is placed into
40 a Record. The string "tru...</div><div class="long"><p>This data type means that the raw data is converted into a boolean before it is placed into
41 a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>
42 <p>The synonym <code>BOOLEAN</code> is equivalent.</p></div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-BOOLEAN"></a><b><a href="source/Types.html#prop-Ext.data.Types-BOOLEAN">BOOLEAN</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into a boolean before it is placed into
43 a Record. The string "tru...</div><div class="long"><p>This data type means that the raw data is converted into a boolean before it is placed into
44 a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>
45 <p>The synonym <code>BOOL</code> is equivalent.</p></div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-DATE"></a><b><a href="source/Types.html#prop-Ext.data.Types-DATE">DATE</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into a Date before it is placed into a Record.
46 The date format is...</div><div class="long">This data type means that the raw data is converted into a Date before it is placed into a Record.
47 The date format is specified in the constructor of the <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">Ext.data.Field</a> to which this type is
48 being applied.</div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-FLOAT"></a><b><a href="source/Types.html#prop-Ext.data.Types-FLOAT">FLOAT</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into a number before it is placed into a Record.
49 The synonym NUMB...</div><div class="long">This data type means that the raw data is converted into a number before it is placed into a Record.
50 <p>The synonym <code>NUMBER</code> is equivalent.</p></div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-INT"></a><b><a href="source/Types.html#prop-Ext.data.Types-INT">INT</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into an integer before it is placed into a Record.
51 The synonym IN...</div><div class="long">This data type means that the raw data is converted into an integer before it is placed into a Record.
52 <p>The synonym <code>INTEGER</code> is equivalent.</p></div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-INTEGER"></a><b><a href="source/Types.html#prop-Ext.data.Types-INTEGER">INTEGER</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into an integer before it is placed into a Record.
53 The synonym IN...</div><div class="long">This data type means that the raw data is converted into an integer before it is placed into a Record.
54 <p>The synonym <code>INT</code> is equivalent.</p></div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-NUMBER"></a><b><a href="source/Types.html#prop-Ext.data.Types-NUMBER">NUMBER</a></b> : Object.<div class="mdesc"><div class="short">This data type means that the raw data is converted into a number before it is placed into a Record.
55 The synonym FLOA...</div><div class="long">This data type means that the raw data is converted into a number before it is placed into a Record.
56 <p>The synonym <code>FLOAT</code> is equivalent.</p></div></div></td><td class="msource">Types</td></tr><tr class="property-row "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-STRING"></a><b><a href="source/Types.html#prop-Ext.data.Types-STRING">STRING</a></b> : Object.<div class="mdesc">This data type means that the raw data is converted into a String before it is placed into a Record.</div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi"> </a></td><td class="sig"><a id="Ext.data.Types-stripRe"></a><b><a href="source/Types.html#prop-Ext.data.Types-stripRe">stripRe</a></b> : Regexp<div class="mdesc"><div class="short">A regular expression for stripping non-numeric characters from a numeric value. Defaults to /[\$,%]/g.
57 This should be...</div><div class="long">A regular expression for stripping non-numeric characters from a numeric value. Defaults to <tt>/[\$,%]/g</tt>.
58 This should be overridden for localization.</div></div></td><td class="msource">Types</td></tr></tbody></table><a id="Ext.data.Types-methods"></a><h2>Public Methods</h2><div class="no-members">This class has no public methods.</div><a id="Ext.data.Types-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>