diff options
Diffstat (limited to 'kvision-modules/kvision-bootstrap-select-remote')
2 files changed, 38 insertions, 22 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 74cb3694..a81d7f2d 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 @@ -116,6 +116,14 @@ open class SelectRemote<T : Any>( input.selectWidthType = value } /** + * The dropdown align of the select control. + */ + var dropdownAlign + get() = input.dropdownAlign + set(value) { + input.dropdownAlign = value + } + /** * Determines if an empty option is automatically generated. */ var emptyOption diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt index af3f1a52..f1643e3d 100644 --- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt +++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt @@ -68,29 +68,37 @@ open class SelectRemoteInput<T : Any>( q = "{{{q}}}" } val tempAjaxOptions = ajaxOptions ?: AjaxOptions() - this.ajaxOptions = tempAjaxOptions.copy(url = url, preprocessData = { - @Suppress("UnsafeCastFromDynamic") - JSON.plain.parse(RemoteOption.serializer().list, it.result as String).map { - obj { - this.value = it.value - if (it.text != null) this.text = it.text - if (it.className != null) this.`class` = it.className - if (it.disabled) this.disabled = true - if (it.divider) this.divider = true - this.data = obj { - if (it.subtext != null) this.subtext = it.subtext - if (it.icon != null) this.icon = it.icon - if (it.content != null) this.content = it.content + this.ajaxOptions = tempAjaxOptions.copy( + url = url, + preprocessData = { + @Suppress("UnsafeCastFromDynamic") + JSON.plain.parse(RemoteOption.serializer().list, it.result as String).map { + obj { + this.value = it.value + if (it.text != null) this.text = it.text + if (it.className != null) this.`class` = it.className + if (it.disabled) this.disabled = true + if (it.divider) this.divider = true + this.data = obj { + if (it.subtext != null) this.subtext = it.subtext + if (it.icon != null) this.icon = it.icon + if (it.content != null) this.content = it.content + } } - } - }.toTypedArray() - }, data = data, beforeSend = { _, b -> - @Suppress("UnsafeCastFromDynamic") - val q = decodeURIComponent(b.data.substring(2)) - val state = stateFunction?.invoke() - b.data = JSON.plain.stringify(JsonRpcRequest(0, url, listOf(q, this.value, state))) - true - }, httpType = HttpType.valueOf(method.name), cache = false, preserveSelected = true) + }.toTypedArray() + }, + data = data, + beforeSend = { _, b -> + @Suppress("UnsafeCastFromDynamic") + val q = decodeURIComponent(b.data.substring(2)) + val state = stateFunction?.invoke() + b.data = JSON.plain.stringify(JsonRpcRequest(0, url, listOf(q, this.value, state))) + true + }, + httpType = HttpType.valueOf(method.name), + cache = false, + preserveSelected = ajaxOptions?.preserveSelected ?: true + ) if (value != null) { GlobalScope.launch { val callAgent = CallAgent() |