3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
16 <div id="cls-Ext.data.SortTypes"></div>/**
17 * @class Ext.data.SortTypes
19 * Defines the default sorting (casting?) comparison functions used when sorting data.
21 Ext.data.SortTypes = {
22 <div id="method-Ext.data.SortTypes-none"></div>/**
23 * Default sort that does nothing
24 * @param {Mixed} s The value being converted
25 * @return {Mixed} The comparison value
31 <div id="prop-Ext.data.SortTypes-stripTagsRE"></div>/**
32 * The regular expression used to strip tags
36 stripTagsRE : /<\/?[^>]+>/gi,
38 <div id="method-Ext.data.SortTypes-asText"></div>/**
39 * Strips all HTML tags to sort on text only
40 * @param {Mixed} s The value being converted
41 * @return {String} The comparison value
44 return String(s).replace(this.stripTagsRE, "");
47 <div id="method-Ext.data.SortTypes-asUCText"></div>/**
48 * Strips all HTML tags to sort on text only - Case insensitive
49 * @param {Mixed} s The value being converted
50 * @return {String} The comparison value
52 asUCText : function(s){
53 return String(s).toUpperCase().replace(this.stripTagsRE, "");
56 <div id="method-Ext.data.SortTypes-asUCString"></div>/**
57 * Case insensitive string
58 * @param {Mixed} s The value being converted
59 * @return {String} The comparison value
61 asUCString : function(s) {
62 return String(s).toUpperCase();
65 <div id="method-Ext.data.SortTypes-asDate"></div>/**
67 * @param {Mixed} s The value being converted
68 * @return {Number} The comparison value
70 asDate : function(s) {
77 return Date.parse(String(s));
80 <div id="method-Ext.data.SortTypes-asFloat"></div>/**
82 * @param {Mixed} s The value being converted
83 * @return {Float} The comparison value
85 asFloat : function(s) {
86 var val = parseFloat(String(s).replace(/,/g, ""));
87 return isNaN(val) ? 0 : val;
90 <div id="method-Ext.data.SortTypes-asInt"></div>/**
92 * @param {Mixed} s The value being converted
93 * @return {Number} The comparison value
96 var val = parseInt(String(s).replace(/,/g, ""), 10);
97 return isNaN(val) ? 0 : val;