A5.ListBoxinsertRows Method





The index or value in the list at which to insert the new rows. See A5.ListBox.getIndex.


Data to insert into the list.


Insert new data into the list.


This method can be used to insert rows into the current data. The rows will be inserted at the given index before order and filter operations are done. If the data cannot be inserted because of an invalid index, the rows will be appended to the current data.


// To get a pointer to the A5.ListBox class see {dialog.object}.getControl
// assume lObj is a pointer to an instance of the A5.ListBox class
var data = [{name: 'Fred Smith', age: 23}];
lObj.insertRows(3,data); // the new row is insert as the 4th item in the list

Example: Inserting Data into a List Control in a UX Component

You can specify a zero-based numeric index to indicate what row to insert the data after or a 'value' (e.g. 'Smith') where 'value' is the value returned by the List. When you specify a value, the data will be inserted after the row in where the value appears.

In the example shown below, two rows are inserted after the 4th row in a List Control in a UX Component.

var listObj = {dialog.object}.getControl('LIST1');

var _d = [
        {firstname: 'John', lastname: 'Smith'},
        {firstname: 'Fred', lastname: 'Harris'}

// insert data after the 4th row.

In this next example, another record is inserted after the row with the value 'Smith':

var listObj = {dialog.object}.getControl('LIST1');

var _d = [
    {firstname: 'Debbie', lastname; 'Vern'}

// insert data after the row with 'Smith'.

See Also