TreeList.filter

Syntax

filter(value: String, column: Number, method: Function);

Parameters

value. Filter value;

number. Number of column in hierarchical tree table. Optional parameter;

method. Custom function used for filtering items of the hierarchical tree. Optional parameter.

Description

The filter method filters nodes in a hierarchical tree.

Example

To execute this example, the page must contain the TreeList component named treeListSett (see the page Example of Creating the TreeList Component). Let the tree show only nodes whose names start with S and parents of these nodes:

// Define filter function
var filterMethod = function (treeNode, value, column) {
    // Get the first letter in tree node name
    var firstLetter = treeNode.getText().charAt(0);
    // Check if this letter matches the desired one
    if (firstLetter == value) {
        return true
    } else {
        return false;
    }
};
// Keep the tree nodes starting with the letter S and their parents
treeListSett.filter("S", 0, filterMethod);

After executing the example the tree shows only nodes whose names start with the letter S and parents of these nodes:

See also:

TreeList