A mixin which allows a data component to be sorted. This is used by e.g. Ext.data.Store and Ext.data.TreeStore.
*NOTE**: This mixin is mainly for internal library 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 Ext.data.Store or Ext.data.TreeStore.
The default sort direction to use if one is not specified (defaults to "ASC")
The default sort direction to use if one is not specified (defaults to "ASC")
Flag denoting that this object is sortable. Always true.
Flag denoting that this object is sortable. Always true.
Returns an object describing the current sort state of this Store.
Returns an object describing the current sort state of this Store.
The sort state of the Store. An object with two properties:
The name of the field by which the Records are sorted.
The sort order, 'ASC' or 'DESC' (case-sensitive).
Performs initialization of this mixin. Component classes using this mixin should call this method during their own initialization.
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
myStore.sort([
{
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:
store.sort('myField');
store.sort('myField');
Is equivalent to this code, because Store handles the toggling automatically:
store.sort('myField', 'ASC');
store.sort('myField', 'DESC');
Either a string name of one of the fields in this Store's configured Model, or an Array of sorter configurations.
The overall direction to sort the data by. Defaults to "ASC".