aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-02-26 13:30:23 +0100
committerRobert Jaros <rjaros@finn.pl>2020-02-26 13:30:23 +0100
commit99dcb8e434d7e0ccf5dada379c1b03e894e6aa82 (patch)
tree25e6a9d47fdbddfc2af2d97eae35e1dba8d44490 /kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft
parent9a8525f2e5cb50071c076032fdcef5a48060108e (diff)
downloadkvision-99dcb8e434d7e0ccf5dada379c1b03e894e6aa82.tar.gz
kvision-99dcb8e434d7e0ccf5dada379c1b03e894e6aa82.tar.bz2
kvision-99dcb8e434d7e0ccf5dada379c1b03e894e6aa82.zip
Major changes in the event handling architecture. Support for multiple event handlers.
Diffstat (limited to 'kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft')
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt13
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt3
2 files changed, 10 insertions, 6 deletions
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
index cd8b5817..9f66afd8 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
@@ -205,15 +205,18 @@ open class Select(
}
@Suppress("UNCHECKED_CAST")
- override fun <T : Widget> setEventListener(block: SnOn<T>.() -> Unit): Widget {
- input.setEventListener(block)
- return this
+ override fun <T : Widget> setEventListener(block: SnOn<T>.() -> Unit): Int {
+ return input.setEventListener(block)
}
@Deprecated("Use onEvent extension function instead.", ReplaceWith("onEvent(block)", "pl.treksoft.kvision.core.onEvent"))
- override fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget {
+ override fun setEventListener(block: SnOn<Widget>.() -> Unit): Int {
@Suppress("DEPRECATION")
- input.setEventListener(block)
+ return input.setEventListener(block)
+ }
+
+ override fun removeEventListener(id: Int): Widget {
+ input.removeEventListener(id)
return this
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
index fe574fa7..a96e614e 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
@@ -28,6 +28,7 @@ import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.CssSize
import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.core.StringPair
+import pl.treksoft.kvision.core.onEvent
import pl.treksoft.kvision.form.FormInput
import pl.treksoft.kvision.form.InputSize
import pl.treksoft.kvision.form.ValidationStatus
@@ -149,7 +150,7 @@ open class SelectInput(
init {
setChildrenFromOptions()
- this.setInternalEventListener<SelectInput> {
+ this.onEvent {
change = {
val v = getElementJQuery()?.`val`()
self.value = v?.let {