3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
15 <div id="cls-Ext.data.SortTypes"></div>/**
\r
16 * @class Ext.data.SortTypes
\r
18 * Defines the default sorting (casting?) comparison functions used when sorting data.
\r
20 Ext.data.SortTypes = {
\r
21 <div id="method-Ext.data.SortTypes-none"></div>/**
\r
22 * Default sort that does nothing
\r
23 * @param {Mixed} s The value being converted
\r
24 * @return {Mixed} The comparison value
\r
30 <div id="prop-Ext.data.SortTypes-stripTagsRE"></div>/**
\r
31 * The regular expression used to strip tags
\r
35 stripTagsRE : /<\/?[^>]+>/gi,
\r
37 <div id="method-Ext.data.SortTypes-asText"></div>/**
\r
38 * Strips all HTML tags to sort on text only
\r
39 * @param {Mixed} s The value being converted
\r
40 * @return {String} The comparison value
\r
42 asText : function(s){
\r
43 return String(s).replace(this.stripTagsRE, "");
\r
46 <div id="method-Ext.data.SortTypes-asUCText"></div>/**
\r
47 * Strips all HTML tags to sort on text only - Case insensitive
\r
48 * @param {Mixed} s The value being converted
\r
49 * @return {String} The comparison value
\r
51 asUCText : function(s){
\r
52 return String(s).toUpperCase().replace(this.stripTagsRE, "");
\r
55 <div id="method-Ext.data.SortTypes-asUCString"></div>/**
\r
56 * Case insensitive string
\r
57 * @param {Mixed} s The value being converted
\r
58 * @return {String} The comparison value
\r
60 asUCString : function(s) {
\r
61 return String(s).toUpperCase();
\r
64 <div id="method-Ext.data.SortTypes-asDate"></div>/**
\r
66 * @param {Mixed} s The value being converted
\r
67 * @return {Number} The comparison value
\r
69 asDate : function(s) {
\r
76 return Date.parse(String(s));
\r
79 <div id="method-Ext.data.SortTypes-asFloat"></div>/**
\r
81 * @param {Mixed} s The value being converted
\r
82 * @return {Float} The comparison value
\r
84 asFloat : function(s) {
\r
85 var val = parseFloat(String(s).replace(/,/g, ""));
\r
86 return isNaN(val) ? 0 : val;
\r
89 <div id="method-Ext.data.SortTypes-asInt"></div>/**
\r
91 * @param {Mixed} s The value being converted
\r
92 * @return {Number} The comparison value
\r
94 asInt : function(s) {
\r
95 var val = parseInt(String(s).replace(/,/g, ""), 10);
\r
96 return isNaN(val) ? 0 : val;
\r