item(index, [item], [update])

Class: List.

Description:

Gets, sets or updates an item at a specified index. Check usage examples below.

Parameters:

Name Type Default Description

index

number

Index of the list item

[item]

Object

Item object. See object format in the example of ComboBox.add() documentation.

[update]

boolean

false

true to update specified item properties with provided item properties, false to replace the item with new one. Default is false.

Returns:

If item argument is passed, then this List instance is returned, otherwise item at specified index is returned. If index is out of range, undefined is returned.

Type: List | object

Examples:

const item = list.item(3); // gets the item at index 3
list.item(3, {text: "New text", value:"new value"}); // replaces item at index 3
list.item(3, {background: "#FF7777"}, true); // changes item's background color at index 3