aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-02-09 22:52:16 +0100
committerRobert Jaros <rjaros@finn.pl>2020-02-09 22:52:16 +0100
commit8dc78d8725e4af290aa99fc943e695b3220777a9 (patch)
tree4e13c9f0214369fdbddec2be04bd104b18d70b02 /kvision-modules
parenta9888d2d9e00abc27d93413f626c75c33651c97e (diff)
downloadkvision-8dc78d8725e4af290aa99fc943e695b3220777a9.tar.gz
kvision-8dc78d8725e4af290aa99fc943e695b3220777a9.tar.bz2
kvision-8dc78d8725e4af290aa99fc943e695b3220777a9.zip
Small fix for TypeaheadInput value handling
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TaAjaxOptions.kt2
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt6
2 files changed, 6 insertions, 2 deletions
diff --git a/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TaAjaxOptions.kt b/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TaAjaxOptions.kt
index ee4d7153..29dc9dc9 100644
--- a/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TaAjaxOptions.kt
+++ b/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TaAjaxOptions.kt
@@ -61,7 +61,7 @@ enum class DataType(internal val type: String) {
data class TaAjaxOptions(
val url: String,
val preprocessQuery: ((String) -> dynamic)? = null,
- val preprocessData: ((dynamic) -> dynamic)? = null,
+ val preprocessData: ((dynamic) -> Array<String>)? = null,
val beforeSend: ((JQueryXHR, dynamic) -> dynamic)? = null,
val httpType: HttpType = HttpType.GET,
val dataType: DataType = DataType.JSON,
diff --git a/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt b/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt
index 0cbfb1c2..bf0622f1 100644
--- a/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt
+++ b/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt
@@ -100,6 +100,7 @@ open class TypeaheadInput(
@Suppress("UnsafeCastFromDynamic")
override fun afterInsert(node: VNode) {
getElementJQueryD()?.typeahead(getSettingsObj())
+ refreshState()
}
override fun afterDestroy() {
@@ -107,7 +108,7 @@ open class TypeaheadInput(
}
@Suppress("UnsafeCastFromDynamic")
- private fun getSettingsObj(): dynamic {
+ protected fun getSettingsObj(): dynamic {
val sourceOpt = when {
options != null -> {
options?.toTypedArray()?.asDynamic()
@@ -161,6 +162,9 @@ open class TypeaheadInput(
this.autoSelect = autoSelect
this.delay = delay
this.fitToElement = fitToElement
+ this.afterSelect = { v: String ->
+ this@TypeaheadInput.value = v
+ }
}
}