aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-tabulator/src
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-tabulator/src')
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt3
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt9
2 files changed, 12 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 906b0c82..7a9ef0ed 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
@@ -355,6 +355,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
}
@@ -379,6 +380,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
@@ -388,6 +390,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 ed803109..c609a400 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
@@ -37,6 +37,8 @@ import pl.treksoft.kvision.utils.JSON
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
import redux.RAction
import pl.treksoft.kvision.redux.*
@@ -528,6 +530,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