Constructor
new SelectionComponent(optionsopt)
Parameters:
Name |
Type |
Attributes |
Default |
Description |
options |
Object
|
<optional>
|
{}
|
Properties
Name |
Type |
Attributes |
Default |
Description |
items |
Array.<string>
|
Array.<{{string}, {string}}>
|
<optional>
|
[]
|
An array of strings or an array of (key,value) tuples. |
|
- Source:
Example
const selectionComponent = new SelectionComponent(undefined, {
items: [
{ name: 'First option', 'first_option'},
{ name: 'Second option', 'second_option'}
]
})
// Listen for selection changes
selectionComponent.addListener(SelectionComponent.SelectionIndexChangedEvent, (eventName, itemIndex) => {
console.log('Selected changed', itemIndex)
})