kvision / pl.treksoft.kvision.form.select / Select

Select

open class Select : SimplePanel, StringFormControl

The form field component for Select control.

The select control can be populated directly from options parameter or manually by adding SelectOption or SelectOptGroup components to the container.

Constructors

<init>

Select(options: List<StringPair>? = null, value: String? = null, multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null, rich: Boolean = false)

Properties

ajaxOptions

var ajaxOptions: AjaxOptions?

Additional options for remote (AJAX) data source.

autofocus

var autofocus: Boolean?

Determines if the select is automatically focused.

disabled

open var disabled: Boolean

Determines if the field is disabled.

emptyOption

var emptyOption: Boolean

Determines if an empty option is automatically generated.

flabel

val flabel: FieldLabel

Form field label.

input

val input: SelectInput

The actual input component.

label

var label: String?

The label text bound to the select element.

liveSearch

var liveSearch: Boolean

Determines if live search is available.

maxOptions

var maxOptions: Int?

Maximal number of selected options.

multiple

var multiple: Boolean

Determines if multiple value selection is allowed.

name

var name: String?

The name attribute of the generated HTML select element.

options

var options: List<StringPair>?

A list of options (label to value pairs) for the select control.

placeholder

var placeholder: String?

The placeholder for the select control.

rich

var rich: Boolean

Determines if label can contain HTML code.

selectWidth

var selectWidth: CssSize?

The width of the select control.

selectWidthType

var selectWidthType: SELECTWIDTHTYPE?

The width type of the select control.

size

open var size: INPUTSIZE?

Input control size.

style

var style: BUTTONSTYLE?

The style of the select control.

validationInfo

val validationInfo: HelpBlock

Validation info component.

value

open var value: String?

A value of the selected option.

Functions

add

open fun add(child: Component): SimplePanel

Adds given component to the current container.

addAll

open fun addAll(children: List<Component>): SimplePanel

Adds a list of components to the current container.

getChildren

open fun getChildren(): List<Component>

Returns a list of children of the current container.

getSnClass

open fun getSnClass(): List<StringBoolPair>

Returns list of CSS class names for current widget in the form of a List.

hideOptions

open fun hideOptions(): Unit

Hides dropdown with options.

remove

open fun remove(child: Component): SimplePanel

Removes given component from the current container.

removeAll

open fun removeAll(): SimplePanel

Removes all children from the current container.

removeEventListeners

open fun removeEventListeners(): Widget

Removes all event listeners from current widget.

setEventListener

open fun <T : Widget> setEventListener(block: SnOn<T>.() -> Unit): Widget

Sets an event listener for current widget, keeping the actual type of component.

open fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget

Sets an event listener for current widget.

showOptions

open fun showOptions(): Unit

Opens dropdown with options.

toggleOptions

open fun toggleOptions(): Unit

Toggles visibility of dropdown with options.

Inherited Functions

addInternal

fun addInternal(child: Component): SimplePanel

Protected and final method to add given component to the current container.

childrenVNodes

open fun childrenVNodes(): Array<VNode>

Returns the array of the children Snabbdom vnodes.

getValue

open fun getValue(): String?

Returns the value of the control.

getValueAsString

open fun getValueAsString(): String?

Returns the value of the control as a String.

render

open fun render(): VNode

Renders current component as a Snabbdom vnode.

setValue

open fun setValue(v: Any?): Unit

Sets the value of the control.

Companion Object Functions

select

fun Container.select(options: List<StringPair>? = null, value: String? = null, multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null, rich: Boolean = false, init: Select.() -> Unit = null): Unit

DSL builder extension function