Clear Up
SharpKit Reference

Sortable Interface

A mixin which allows a data component to be sorted. This is used by e.g. and

NOTE: This mixin is mainly for internal use and most users should not need to use it directly. It is more likely you will want to use one of the component classes that import this mixin, such as or

Namespace: Ext.util


Name Description
className Defaults to: "Ext.Base"
configMap Defaults to: {}
defaultSortDirection The default sort direction to use if one is not specified. Defaults to: "ASC"
initConfigList Defaults to: []
initConfigMap Defaults to: {}
isInstance Defaults to: true
isSortable true in this class to identify an object as an instantiated Sortable, or subclass thereof. Defaults to: true
self Get the reference to the current class from which this object was instantiated. Unlike statics, this.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics for a detailed comparison
  Ext.define('My.Cat', {
            statics: {
            speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
            constructor: function() {
            alert(this.self.speciesName); // dependent on 'this'
            clone: function() {
            return new this.self();
            Ext.define('My.SnowLeopard', {
            extend: 'My.Cat',
            statics: {
            speciesName: 'Snow Leopard'         // My.SnowLeopard.speciesName = 'Snow Leopard'
            var cat = new My.Cat();                     // alerts 'Cat'
            var snowLeopard = new My.SnowLeopard();     // alerts 'Snow Leopard'
            var clone = snowLeopard.clone();
            alert(Ext.getClassName(clone));             // alerts 'My.SnowLeopard'
sorters The collection of Sorters currently applied to this Store
sortRoot The property in each item that contains the data to sort.


Name Description
decodeSorters(JsArray<T>) Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances
generateComparator() Returns a comparator function which compares two items and returns -1, 0, or 1 depending on the currently defined set of sorters. If there are no sorters defined, it returns a function which returns 0 meaning that no sorting will occur.
getFirstSorter() Gets the first sorter from the sorters collection, excluding any groupers that may be in place
initSortable() Performs initialization of this mixin. Component classes using this mixin should call this method during their own initialization.
sort(object, object) Sorts the data in the Store by one or more of its properties. Example usage:
//sort by a single field
            myStore.sort('myField', 'DESC');
            //sorting by multiple fields
            property : 'age',
            direction: 'ASC'
            property : 'name',
            direction: 'DESC'
Internally, Store converts the passed arguments into an array of Ext.util.Sorter instances, and delegates the actual sorting to its internal Ext.util.MixedCollection. When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:
Is equivalent to this code, because Store handles the toggling automatically:
store.sort('myField', 'ASC');
            store.sort('myField', 'DESC');
© Copyright 2005-2011 SharpKit. All rights reserved.