For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

Sencha Documentation

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.

Defined By

Properties

 

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.

 

The property in each item that contains the data to sort. (defaults to null)

The property in each item that contains the data to sort. (defaults to null)

 
sorters : Ext.util.MixedCollection

The collection of Sorters currently applied to this Store

The collection of Sorters currently applied to this Store

Defined By

Methods

 

Returns an object describing the current sort state of this Store.

Returns an object describing the current sort state of this Store.

Returns

  • Object   

    The sort state of the Store. An object with two properties:

    • field : String

      The name of the field by which the Records are sorted.

    • direction : String

      The sort order, 'ASC' or 'DESC' (case-sensitive).

    See sortInfo for additional details.

 
Performs initialization of this mixin. Component classes using this mixin should call this method during their own in...

Performs initialization of this mixin. Component classes using this mixin should call this method during their own initialization.

Returns

  • void   
 
sort( String|Array sorters, String direction, Object where, Object doSort) : void
Sorts the data in the Store by one or more of its properties. Example usage: //sort by a single field myStore.sort(...

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');

Parameters

  • sorters : String|Array

    Either a string name of one of the fields in this Store's configured Model, or an Array of sorter configurations.

  • direction : String

    The overall direction to sort the data by. Defaults to "ASC".

  • where : Object
  • doSort : Object

Returns

  • void