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

Class: ComboBox.

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]

ListItem

ListItem formatted object. See ListItem 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 ComboBox instance is returned, otherwise item at specified index is returned. If index is out of range, undefined is returned.

Type: ComboBox | ListItem

Examples:

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

Also See: