top

SORTMODE

SortMode is a common class used for sorting of queried data. The result of sorting based on attributes of list type is undetermined.

Add the following line for SortMode class into a html file your own :

  script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js">/script>

You can declare SortMode class like this :

  ex) var filter = new webapis.SortMode("parm1", "parm2");


Constructor

SortMode

Description
SortMode is a common interface used for sorting of queried data. The result of sorting based on attributes of list type is undetermined.
Parameters
attributeName DOMStringName of the object attribute used for sorting.
order SortModeOrderType of the sorting. By default, this attribute is set to “ASC”.
Emulator Support
SDK Constraint
Example
// Define a success callback
function successCallback(contacts) {
    // The returned contacts are sorted by first name (ascending)
    console.log(contacts.length + " contacts found.");
}

// Define an error callback
function errorCallback(error) {
    console.log("An error occurred: " + error.message);
}

// Create an attribute filter based on first name: "First name should contain 'Chris' (case insensitive)"
var filter = new webapis.AttributeFilter("name.firstName", "CONTAINS", "Chris");
// Sort by first name, ascending
var sortMode = new webapis.SortMode("name.firstName", "ASC");
// Send request on contact address book.
webapis.contact.getDefaultAddressBook().find(successCB, errorCB, filter, sortMode);