aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-06-21 20:35:07 +0200
committerRobert Jaros <rjaros@finn.pl>2019-06-21 20:35:07 +0200
commit231dd9f27ded19123cfa341596850ffd5471d177 (patch)
treeca540bccc43b130f4f175d143e4cca17559971bb /kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision
parent075280076d373dad01666397f7b857aad8450b7c (diff)
downloadkvision-231dd9f27ded19123cfa341596850ffd5471d177.tar.gz
kvision-231dd9f27ded19123cfa341596850ffd5471d177.tar.bz2
kvision-231dd9f27ded19123cfa341596850ffd5471d177.zip
Upgrade tabulator to 4.2.7.
Fix for table refresh crash with active custom editor.
Diffstat (limited to 'kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision')
-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.kt8
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