Class Select
Define a Select block to be displayed into a JBlocks.
- Defined in: jblocks.block.select.js
- Extends List
Constructor Attributes | Constructor Name and Description |
---|---|
Select()
An Select block allows the selection of a value amongst a finite set of options. |
Method Summary
Class Detail
Select()
An Select block allows the selection of a value amongst a finite set of options. The block has two states: it is initally closed, showing only the selected value in a 1 unit high blocks. Once clicked, it displays a regular list.
The constructor should not be invoked directly but JBlocks#newBlock or JBlocks#addNewBlock should be used instead.
Method Detail
-
init(layout, options)Initializes a Select block. The method is invoked by the jBlocks core and must never be called directly.
- Parameters:
- {Object} layout Optional
- see List#init.
- {Object} options Optional
- in addition to base class options List#init:
- {Boolean} options.opened Optional, Default: false
- the initial state.
- {String} options.selected Optional, Default: null
- the initial selected value.
- {String} options.selWidgetClass Optional
- the class to be used for the closed state widget.
- {Function} options.onChange Optional
- a function(value) being called when the selected value changes.
-
val(text)Get or set the selection.
- Parameters:
- {String} text Optional
- if an argument is used, the current selection is replaced.
- Returns:
- the currently selected key.