Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.data.SortTypes.html
1 <!DOCTYPE html><html><head><title>Ext.data.SortTypes | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.data.SortTypes',
13         docClass: 'Ext.data.SortTypes',
14         docReq: 'Ext.data.SortTypes',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'SortTypes.html#Ext-data.SortTypes';
33     clsInfo = {"methods":["asDate","asFloat","asInt","asText","asUCString","asUCText","none"],"cfgs":[],"properties":["stripTagsRE"],"events":[],"subclasses":[]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/SortTypes.html#Ext-data.SortTypes" target="_blank">Ext.data.SortTypes</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>This class defines a series of static methods that are used on a
38 <a href="Ext.data.Field.html" rel="Ext.data.Field" class="docClass">Ext.data.Field</a> for performing sorting. The methods cast the
39 underlying values into a data type that is appropriate for sorting on
40 that particular field.  If a <a href="Ext.data.Field.html#type" rel="Ext.data.Field#type" class="docClass">Ext.data.Field.type</a> is specified,
41 the sortType will be set to a sane default if the sortType is not
42 explicitly defined on the field. The sortType will make any necessary
43 modifications to the value and return it.</p>
44
45 <ul>
46 <li><b>asText</b> - Removes any tags and converts the value to a string</li>
47 <li><b>asUCText</b> - Removes any tags and converts the value to an uppercase string</li>
48 <li><b>asUCText</b> - Converts the value to an uppercase string</li>
49 <li><b>asDate</b> - Converts the value into Unix epoch time</li>
50 <li><b>asFloat</b> - Converts the value to a floating point number</li>
51 <li><b>asInt</b> - Converts the value to an integer number</li>
52 </ul>
53
54
55 <p>
56 It is also possible to create a custom sortType that can be used throughout
57 an application.
58 <pre class="prettyprint"><code>Ext.apply(Ext.data.SortTypes, {
59     asPerson: function(person){
60         // expects an object with a first and last name property
61         return person.lastName.toUpperCase() + person.firstName.toLowerCase();
62     }    
63 });
64
65 Ext.define('Employee', {
66     extend: 'Ext.data.Model',
67     fields: [{
68         name: 'person',
69         sortType: 'asPerson'
70     }, {
71         name: 'salary',
72         type: 'float' // sortType set to asFloat
73     }]
74 });
75 </code></pre>
76 </p>
77
78 <div class="members"><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-stripTagsRE" class="member f ni"><a href="Ext.data.SortTypes.html#property-stripTagsRE" rel="property-stripTagsRE" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-property-stripTagsRE" class="viewSource">view source</a></div><a name="stripTagsRE"></a><a name="property-stripTagsRE"></a><a href="Ext.data.SortTypes.html#" rel="property-stripTagsRE" class="cls expand">stripTagsRE</a><span> : RegExp</span></div><div class="description"><div class="short"><p>The regular expression used to strip tags</p>
79 </div><div class="long"><p>The regular expression used to strip tags</p>
80 </div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-asDate" class="member f ni"><a href="Ext.data.SortTypes.html#method-asDate" rel="method-asDate" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asDate" class="viewSource">view source</a></div><a name="asDate"></a><a name="method-asDate"></a><a href="Ext.data.SortTypes.html#" rel="method-asDate" class="cls expand">asDate</a>(
81 <span class="pre">Mixed s</span>)
82  : Number</div><div class="description"><div class="short"><p>Date sorting</p>
83 </div><div class="long"><p>Date sorting</p>
84 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
85 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The comparison value</p>
86 </li></ul></div></div></div><div id="method-asFloat" class="member ni"><a href="Ext.data.SortTypes.html#method-asFloat" rel="method-asFloat" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asFloat" class="viewSource">view source</a></div><a name="asFloat"></a><a name="method-asFloat"></a><a href="Ext.data.SortTypes.html#" rel="method-asFloat" class="cls expand">asFloat</a>(
87 <span class="pre">Mixed s</span>)
88  : Float</div><div class="description"><div class="short"><p>Float sorting</p>
89 </div><div class="long"><p>Float sorting</p>
90 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
91 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Float</span>&nbsp; &nbsp;<p>The comparison value</p>
92 </li></ul></div></div></div><div id="method-asInt" class="member ni"><a href="Ext.data.SortTypes.html#method-asInt" rel="method-asInt" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asInt" class="viewSource">view source</a></div><a name="asInt"></a><a name="method-asInt"></a><a href="Ext.data.SortTypes.html#" rel="method-asInt" class="cls expand">asInt</a>(
93 <span class="pre">Mixed s</span>)
94  : Number</div><div class="description"><div class="short"><p>Integer sorting</p>
95 </div><div class="long"><p>Integer sorting</p>
96 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
97 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The comparison value</p>
98 </li></ul></div></div></div><div id="method-asText" class="member ni"><a href="Ext.data.SortTypes.html#method-asText" rel="method-asText" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asText" class="viewSource">view source</a></div><a name="asText"></a><a name="method-asText"></a><a href="Ext.data.SortTypes.html#" rel="method-asText" class="cls expand">asText</a>(
99 <span class="pre">Mixed s</span>)
100  : String</div><div class="description"><div class="short"><p>Strips all HTML tags to sort on text only</p>
101 </div><div class="long"><p>Strips all HTML tags to sort on text only</p>
102 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
103 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The comparison value</p>
104 </li></ul></div></div></div><div id="method-asUCString" class="member ni"><a href="Ext.data.SortTypes.html#method-asUCString" rel="method-asUCString" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asUCString" class="viewSource">view source</a></div><a name="asUCString"></a><a name="method-asUCString"></a><a href="Ext.data.SortTypes.html#" rel="method-asUCString" class="cls expand">asUCString</a>(
105 <span class="pre">Mixed s</span>)
106  : String</div><div class="description"><div class="short"><p>Case insensitive string</p>
107 </div><div class="long"><p>Case insensitive string</p>
108 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
109 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The comparison value</p>
110 </li></ul></div></div></div><div id="method-asUCText" class="member ni"><a href="Ext.data.SortTypes.html#method-asUCText" rel="method-asUCText" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asUCText" class="viewSource">view source</a></div><a name="asUCText"></a><a name="method-asUCText"></a><a href="Ext.data.SortTypes.html#" rel="method-asUCText" class="cls expand">asUCText</a>(
111 <span class="pre">Mixed s</span>)
112  : String</div><div class="description"><div class="short"><p>Strips all HTML tags to sort on text only - Case insensitive</p>
113 </div><div class="long"><p>Strips all HTML tags to sort on text only - Case insensitive</p>
114 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
115 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The comparison value</p>
116 </li></ul></div></div></div><div id="method-none" class="member ni"><a href="Ext.data.SortTypes.html#method-none" rel="method-none" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-none" class="viewSource">view source</a></div><a name="none"></a><a name="method-none"></a><a href="Ext.data.SortTypes.html#" rel="method-none" class="cls expand">none</a>(
117 <span class="pre">Mixed s</span>)
118  : Mixed</div><div class="description"><div class="short"><p>Default sort that does nothing</p>
119 </div><div class="long"><p>Default sort that does nothing</p>
120 <h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
121 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>The comparison value</p>
122 </li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>