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 |
|---|---|---|---|
|
|
number |
Index of the list item |
|
|
|
Object |
Item object. See object format in the example of ComboBox.add() documentation. |
|
|
|
boolean |
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
