TreeColumn.SortMethod

Syntax

SortMethod: Function

Description

The SortMethod property sets function intended for column elements sorting.

Comments

Use JSON or the setSortMethod method to set the property value, and the getSortMethod method to get the property value.

Example

To execute the example, the page must contain the TreeList  component named «treeList» (see Example of Creating the TreeList Component). Set a new sorting method for the tree first column which will sort elements by the second character of the contents:

// Get first tree column
var column = treeListSett.getColumns().getItem(0);
// Set new sorting option
column.setSortMethod(function (nodeA, nodeB, params) {
    if (nodeA.Text.charAt(1) < nodeB.Text.charAt(1)) {
        return 1;
    } else {
        return -1;
    }
    return 0
});
treeListSett.update();

After executing the example clicking the first column header sorts elements by the second character of their contents:

See also:

TreeColumn