ListBox.insertItem

Syntax

insertItem(value: Object, index: Number)

Parameters

value. Element that is necessary to paste into the list. It can be text, HTML layout, Dom node or the delegate PP.Ui.Control.

index. Element index.

Description

The insertItem method adds an element to the position of the elements list set by the index parameter.

Example

To execute the example create the ListBox component as it is shown in the example for the ListBox.filterByText method. Create the HTML button on pressing it the new elements are added to the selected position of the list.

<button onclick="Insert();">Insert</button>

Add the Insert() function to the JavaScript code when executing it three elements are added to the list:

function Insert() {

        LB.insertItem(new PP.Ui.ListItem({ Content: "Fractional" }), 5);

        LB.insertItem(new PP.Ui.ListItem({ Content: "Time" }), 3);

        LB.insertItem(new PP.Ui.ListItem({ Content: "Percentage" }), 0);

        }

After executing the example on pressing the Insert button elements set in the index parameter are added on the positions to the list:

See also:

ListBox