Defined by dojo/data/util/sorter

Basic comparison function that compares if an item is greater or less than another item

returns 1 if a > b, -1 if a < b, 0 if equal. 'null' values (null, undefined) are treated as larger values so that they're pushed to the end of the list. And compared to each other, null is equivalent to undefined.

Parameter Type Description
a anything
b anything

Returns: number


Defined by dojo/data/util/sorter

Helper function to generate the sorting function based off the list of sort attributes.

The sort function creation will look for a property on the store called 'comparatorMap'. If it exists it will look in the mapping for comparisons function for the attributes. If one is found, it will use it instead of the basic comparator, which is typically used for strings, ints, booleans, and dates. Returns the sorting function for this particular list of attributes and sorting directions.

Parameter Type Description
sortSpec attributes[]

A JS object that array that defines out what attribute names to sort on and whether it should be descenting or asending. The objects should be formatted as follows:

    attribute: "attributeName-string" || attribute,
    descending: true|false;   // Default is false.
store dojo/data/api/Read

The datastore object to look up item values from.

Returns: Return an array of property names

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.