diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form/select')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt | 8 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt index dc55dd04..2e9b5562 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt @@ -274,7 +274,7 @@ open class Select( internal var counter = 0 /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -282,8 +282,10 @@ open class Select( options: List<StringPair>? = null, value: String? = null, multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null, rich: Boolean = false, init: (Select.() -> Unit)? = null - ) { - this.add(Select(options, value, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) }) + ): Select { + val select = Select(options, value, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) } + this.add(select) + return select } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt index be986f02..f90401ce 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt @@ -388,7 +388,7 @@ open class SelectInput( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -396,8 +396,10 @@ open class SelectInput( options: List<StringPair>? = null, value: String? = null, multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null - ) { - this.add(SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) }) + ): SelectInput { + val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) } + this.add(selectInput) + return selectInput } } } |