ListBox.filterByText

Syntax

filterByText (value: String);

Parameters

value. The string by which filtration is executed.

Description

The filterByText method filters list elements by string.

Example

To execute the example connect the links to the PP.js libraries and the table of the PP.css visual styles. Create a list named LB. To filter data by a line, create a text entry box with the Text1 identifier and a button with the Button2 identifier that will call the filterByText method:

<input type="text" id="Text1" />

<input type="button" id="Button2" value=Filter onclick="Filter();" />

<div id="LB"></div>

<script type="text/javascript">

    var LB = new PP.Ui.ListBox({

            ParentNode: document.getElementById("LB"),

            Items: [{ Content: "False" },

                { Content: "True" },

                { Content: Money },

                { Content: Financial },

                { Content: Data short format },

                { Content: Data long format }],

            Width: 200

        });

        function Filter()//Function that filters list elements by string

    {

        LB.filterByText(document.getElementById("Text1").value);

    }

</script>

After executing the example the string list, the field for text entering and the filter button are located on the HTML page. Enter text in the input box, click the Filter button. Elements that contain the entered text are given in the list:

See also:

ListBox