TreeList.Finding

Syntax

Find: function (sender,args)

Parameters

sender. Event source.

args. Event information. Available arguments:

Description

The Find occurs when element search is started.

Comments

This event is fired after the user types in a value into the search line and presses ENTER. To open search bar, press CTRL+F or F3. One of the tree elements must be focused.

The search line opens if the TreeList.EnableSearch property is set to true.

Example

To execute this example, the page must contain the TreeList component named treeListSett. Make sure that the TreeList.EnableSearch property is set to true. Add handlers for the events Finingd and Found, and find the element that contains the text Egypt:

//Before search the «Search <search value>» message is displayed
treeListSett.Finding.add(function (sender, args)
{
    alert("Search " + args.Value)
});
//When the node is found
treeListSett.Found.add(function (sender, args)
{
    treeListSett.setEnableHighlight(true);//enable node highlighting
    args.Node.setHighlighted(true);//set highlight for the found node
    treeListSett.setHighlightColor("LightSeaGreen");//set highlight color for the found node
    treeListSett.setHighlightFont(new PP.Font(//set highlight font for the found node
    {
        IsBold: true
    }));
  //Display search string and found node text to the console
  console.log("The last search: " + treeListSett.getLastSearch().value + "; the last found: " + treeListSett.getLastFound().getText())
})
//Search for the Egypt element
treeListSett.find("Egypt")

After executing the example when the search is started, the following message is shown: Finding Egypt. After the element is found it becomes highlighted:

The following message is displayed to the console:

Last searched: Egypt; last found: Egypt

See also:

TreeList