diff options
Diffstat (limited to 'kvision-modules')
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 + } } } |