Clear Up
SharpKit Reference

MixedCollection Class

Namespace: Ext.util

Methods

Name Description
decodeSorters(JsArray<T>) Normalizes an array of sorter objects, ensuring that they are all Ext.util.Sorter instances
findInsertionIndex(object, object) Calculates the insertion index of the new item based upon the comparison function passed, or the current sort order.
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.
reorder(object) Reorders each of the items based on a mapping from old index to new index. Internally this just translates into a sort. The 'sort' event is fired whenever reordering has occured.
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
            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');
            
sortBy(Delegate) Sorts the collection by a single sorter function
sortByKey(object, Delegate) Sorts this collection by keys.

Properties

Name Description
defaultSortDirection The default sort direction to use if one is not specified. Defaults to: "ASC"
isSortable true in this class to identify an object as an instantiated Sortable, or subclass thereof. Defaults to: true
sorters The collection of Sorters currently applied to this Store
sortRoot The property in each item that contains the data to sort.
© Copyright 2005-2011 SharpKit. All rights reserved.