3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
9 * @class Ext.data.SortTypes
11 * Defines the default sorting (casting?) comparison functions used when sorting data.
13 Ext.data.SortTypes = {
15 * Default sort that does nothing
16 * @param {Mixed} s The value being converted
17 * @return {Mixed} The comparison value
24 * The regular expression used to strip tags
28 stripTagsRE : /<\/?[^>]+>/gi,
31 * Strips all HTML tags to sort on text only
32 * @param {Mixed} s The value being converted
33 * @return {String} The comparison value
36 return String(s).replace(this.stripTagsRE, "");
40 * Strips all HTML tags to sort on text only - Case insensitive
41 * @param {Mixed} s The value being converted
42 * @return {String} The comparison value
44 asUCText : function(s){
45 return String(s).toUpperCase().replace(this.stripTagsRE, "");
49 * Case insensitive string
50 * @param {Mixed} s The value being converted
51 * @return {String} The comparison value
53 asUCString : function(s) {
54 return String(s).toUpperCase();
59 * @param {Mixed} s The value being converted
60 * @return {Number} The comparison value
62 asDate : function(s) {
69 return Date.parse(String(s));
74 * @param {Mixed} s The value being converted
75 * @return {Float} The comparison value
77 asFloat : function(s) {
78 var val = parseFloat(String(s).replace(/,/g, ""));
79 return isNaN(val) ? 0 : val;
84 * @param {Mixed} s The value being converted
85 * @return {Number} The comparison value
88 var val = parseInt(String(s).replace(/,/g, ""), 10);
89 return isNaN(val) ? 0 : val;