File: Ext.data.Types.html

package info (click to toggle)
libjs-extjs 3.4.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 53,188 kB
  • ctags: 3,384
  • sloc: php: 819; xml: 537; python: 60; sql: 44; makefile: 35
file content (58 lines) | stat: -rw-r--r-- 10,494 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<div xmlns:ext="http://www.extjs.com" class="body-wrap"><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/>
<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
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
of this class.</p>
<p>Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE.
each type definition must contain three properties:</p>
<div class="mdetail-params"><ul>
<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
to be stored in the Field. The function is passed the collowing parameters:
<div class="mdetail-params"><ul>
<li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
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>
<li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
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
(<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>
</ul></div></div></li>
<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>
<li><code>type</code> : <i>String</i> <div class="sub-desc">A textual data type name.</div></li>
</ul></div>
<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
which contained the properties <code>lat</code> and <code>long</code>, you would define a new data type like this:</p>
<pre><code><i>// Add a <b>new</b> Field data type which stores a VELatLong object <b>in</b> the Record.</i>
Ext.data.Types.VELATLONG = {
    convert: <b>function</b>(v, data) {
        <b>return</b> <b>new</b> VELatLong(data.lat, data.long);
    },
    sortType: <b>function</b>(v) {
        <b>return</b> v.Latitude;  <i>// When sorting, order by latitude</i>
    },
    type: <em>'VELatLong'</em>
};</code></pre>
<p>Then, when declaring a Record, use <pre><code><b>var</b> types = Ext.data.Types; <i>// allow shorthand type access</i>
UnitRecord = Ext.data.Record.create([
    { name: <em>'unitName'</em>, mapping: <em>'UnitName'</em> },
    { name: <em>'curSpeed'</em>, mapping: <em>'CurSpeed'</em>, type: types.INT },
    { name: <em>'latitude'</em>, mapping: <em>'lat'</em>, type: types.FLOAT },
    { name: <em>'latitude'</em>, mapping: <em>'lat'</em>, type: types.FLOAT },
    { name: <em>'position'</em>, type: types.VELATLONG }
]);</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">&nbsp;</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">&nbsp;</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
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
a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>
<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">&nbsp;</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
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
a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>
<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">&nbsp;</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.
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.
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
being applied.</div></div></td><td class="msource">Types</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</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.
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.
<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">&nbsp;</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.
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.
<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">&nbsp;</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.
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.
<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">&nbsp;</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.
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.
<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">&nbsp;</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">&nbsp;</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.
This should be...</div><div class="long">A regular expression for stripping non-numeric characters from a numeric value. Defaults to <tt>/[\$,%]/g</tt>.
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>