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 the first tree column
var column = treeList.getColumns().getItem(0);
// Set a new sorting method
column.setSortMethod(function (nodeA, nodeB, params) {           
    if (nodeA.Text.charAt(1) >= nodeB.Text.charAt(1)) {
        return true;
    } else {
        return false;
    }
});

Sort elements on clicking the first column heading. As a result, elements are sorted by the second character of its contents:

See also:

TreeColumn