X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/f5240829880f87e0cf581c6a296e436fdef0ef80..6746dc89c47ed01b165cc1152533605f97eb8e8d:/src/data/SortTypes.js?ds=inline diff --git a/src/data/SortTypes.js b/src/data/SortTypes.js index 4b29c49a..3ad612bf 100644 --- a/src/data/SortTypes.js +++ b/src/data/SortTypes.js @@ -1,59 +1,107 @@ -/*! - * Ext JS Library 3.3.0 - * Copyright(c) 2006-2010 Ext JS, Inc. - * licensing@extjs.com - * http://www.extjs.com/license - */ +/* + +This file is part of Ext JS 4 + +Copyright (c) 2011 Sencha Inc + +Contact: http://www.sencha.com/contact + +GNU General Public License Usage +This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. +*/ /** * @class Ext.data.SortTypes + * This class defines a series of static methods that are used on a + * {@link Ext.data.Field} for performing sorting. The methods cast the + * underlying values into a data type that is appropriate for sorting on + * that particular field. If a {@link Ext.data.Field#type} is specified, + * the sortType will be set to a sane default if the sortType is not + * explicitly defined on the field. The sortType will make any necessary + * modifications to the value and return it. + *
+ * It is also possible to create a custom sortType that can be used throughout + * an application. + *
+Ext.apply(Ext.data.SortTypes, {
+ asPerson: function(person){
+ // expects an object with a first and last name property
+ return person.lastName.toUpperCase() + person.firstName.toLowerCase();
+ }
+});
+
+Ext.define('Employee', {
+ extend: 'Ext.data.Model',
+ fields: [{
+ name: 'person',
+ sortType: 'asPerson'
+ }, {
+ name: 'salary',
+ type: 'float' // sortType set to asFloat
+ }]
+});
+ *
+ *
* @singleton
- * Defines the default sorting (casting?) comparison functions used when sorting data.
+ * @docauthor Evan Trimboli