diff options
Diffstat (limited to 'kvision-modules/kvision-bootstrap-select-remote')
2 files changed, 10 insertions, 6 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 550de427..e2f84fff 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 @@ -187,15 +187,18 @@ open class SelectRemote<T : Any>( } @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-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 96277728..d6abc0f6 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 @@ -29,6 +29,7 @@ import kotlinx.serialization.list import kotlinx.serialization.stringify import org.w3c.dom.get import pl.treksoft.kvision.core.Container +import pl.treksoft.kvision.core.onEvent import pl.treksoft.kvision.remote.CallAgent import pl.treksoft.kvision.remote.HttpMethod import pl.treksoft.kvision.remote.JsonRpcRequest @@ -114,7 +115,7 @@ open class SelectRemoteInput<T : Any>( preserveSelected = ajaxOptions?.preserveSelected ?: true ) if (this.ajaxOptions?.emptyRequest == true) { - this.setInternalEventListener<SelectRemote<*>> { + this.onEvent { shownBsSelect = { val input = self.getElementJQuery()?.parent()?.find("input") input?.trigger("keyup", null) |