constructor([items])

Class: ComboBox.

Description:

ComboBox constructor.
Accepts an optional Array parameter: strings ["Item 1","Item 2", ...], numbers [1, 2, 3, ...], item objects [{text:"Item 1"}, {text:"Item 2"}, ...], or a mixture of them.

Parameters:

Name Type Description

[items]

Array.<(string|number|ListItem)>

Items as an Array of objects, strings or numbers. Can be a mix of these types. For item Object's format check out add() method example .

Examples:

// Creating combo box, then adding each item separately.
const combo1 = new ComboBox().add("Item 1").add(45).add({text: "Item 2", font:{bolt:true}});

// Creating combo box, then adding items as an array.
const combo2 = new ComboBox().items([
    "Item 1",
    45,
    {text: "Item 3", font:{bolt:true}}
]);

// Creating combo box with items as a string and object. Items can be a mix of strings and objects.
const combo3 = new ComboBox([
     "Item 1",
     45,
     {text: "Item 3", font:{bolt:true}}
]);

Also See: