List.insert

Syntax

insert (ctrl: PP.Ui.Control, index: Number, fireEvent: Boolean);

Parameters

ctrl. Control to be inserted to the collection. Numbering starts with zero.

index. Index of collection element.

fireEvent. Determines whether an appropriate event is fired on calling the method. If this parameter is set to True, the event is fired, otherwise it is not fired.

Description

The insert method inserts an element to the specified position.

Example

To execute the example create the TreeList component with the treeListSett name. In the BODY tag add the DIV element with the but1 identifier. Create a button clicking which adds a new element to the column list:

var columns = treeListSett.getColumns();
function insert()
{
    columns.insert(new PP.Ui.TreeColumn(
    {
        Caption: "Region",
        Width: 100,
        MinWidth: 50,
        Visible: True
    }), 1)
}
var but = new PP.Ui.Button(
{
    ParentNode: "but1",
    Content: "Insert",
    Width: 50,
    Height: 20
})
but.Click.add(insert);
columns.Changed.add(function (sender, args)
{
    alert("Column added")
}

After executing the example the Insert button is added to the HTML page. Clicking the button adds a new element to the second position of the column list:

The following message appears on the screen: Column is added.

See also:

List