aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap-select-remote
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-05-20 17:12:56 +0200
committerRobert Jaros <rjaros@finn.pl>2020-05-20 17:12:56 +0200
commitef1abc3b975e1c77fc8663c5e5e95769fc934551 (patch)
tree343236378e2f24514635fb5e892043a054c86170 /kvision-modules/kvision-bootstrap-select-remote
parent35628c364d9768a5589559b99cb698ebc2b56eba (diff)
downloadkvision-ef1abc3b975e1c77fc8663c5e5e95769fc934551.tar.gz
kvision-ef1abc3b975e1c77fc8663c5e5e95769fc934551.tar.bz2
kvision-ef1abc3b975e1c77fc8663c5e5e95769fc934551.zip
Make all stateful components implement ObservableState interface
Diffstat (limited to 'kvision-modules/kvision-bootstrap-select-remote')
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
index b4e4738c..18c522d5 100644
--- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
+++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
@@ -31,6 +31,7 @@ import pl.treksoft.kvision.form.StringFormControl
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.remote.KVServiceManager
import pl.treksoft.kvision.remote.RemoteOption
+import pl.treksoft.kvision.state.ObservableState
import pl.treksoft.kvision.utils.SnOn
/**
@@ -60,7 +61,7 @@ open class SelectRemote<T : Any>(
preload: Boolean = false,
label: String? = null,
rich: Boolean = false
-) : SimplePanel(setOf("form-group")), StringFormControl {
+) : SimplePanel(setOf("form-group")), StringFormControl, ObservableState<String?> {
/**
* A value of the selected option.
*/
@@ -254,6 +255,12 @@ open class SelectRemote<T : Any>(
input.blur()
}
+ override fun getState(): String? = input.getState()
+
+ override fun subscribe(observer: (String?) -> Unit): () -> Unit {
+ return input.subscribe(observer)
+ }
+
companion object {
internal var counter = 0
}