diff options
Diffstat (limited to 'kvision-modules/kvision-tabulator/src/main')
2 files changed, 11 insertions, 0 deletions
diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt index 08f2603b..53f958e5 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt @@ -356,6 +356,7 @@ data class ColumnDefinition<T : Any>( internal object EditorRoot { internal var root: Root? = null + internal var cancel: ((value: dynamic) -> Unit)? = null internal var disposeTimer: Int? = null } @@ -384,6 +385,7 @@ fun <T : Any> ColumnDefinition<T>.toJs( root?.dispose() disposeTimer = null root = null + EditorRoot.cancel = null }, 500) }, cancel, data) val rootElement = document.createElement("div") as HTMLElement @@ -393,6 +395,7 @@ fun <T : Any> ColumnDefinition<T>.toJs( root?.dispose() } root = Root(element = rootElement) + EditorRoot.cancel = cancel @Suppress("UnsafeCastFromDynamic") root?.add(component) (component as? FormControl)?.focus() diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt index 72a2809a..01af46c6 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt @@ -40,6 +40,7 @@ import pl.treksoft.kvision.utils.createInstance import pl.treksoft.kvision.utils.obj import pl.treksoft.kvision.utils.syncWithList import redux.RAction +import kotlin.browser.window import pl.treksoft.kvision.tabulator.js.Tabulator as JsTabulator /** @@ -558,6 +559,13 @@ open class Tabulator<T : Any>( jsTabulator?.navigateDown() } + internal fun removeCustomEditors() { + EditorRoot.cancel?.invoke(null) + EditorRoot.disposeTimer?.let { window.clearTimeout(it) } + EditorRoot.root?.dispose() + EditorRoot.root = null + } + companion object { internal var counter = 0 |