Tomas Kormanak
03/02/2021, 5:06 PMdata class Voice(var _id: Id? = null, var name: String? = null)
val options = TabulatorOptions(
layout = Layout.FITCOLUMNS,
columns = listOf(ColumnDefinition(tr("Name"), Voice::name.name))
),
val entities: ObservableList<E> = observableListOf()
tabulator = Tabulator(entities, options = options)
It used to work well, but after upgrade to 3.17.0 we can see only empty rows.
I think it's because of this commit:
https://github.com/rjaros/kvision/commit/5406e9e7b4cf8b516e9070179bb702038e2af46a
since then data are converted to plain object in Tabulator::replaceData
Also getData()
now returns plain object instead of original object:
tabulatorRowClick = { e ->
val entity = (e.detail as JsTabulator.RowComponent).getData() as E
// .... do something with entity
}
Am I missing something or is there a new way how to use Tabulator we should use?Robert Jaros
03/02/2021, 5:08 PMTomas Kormanak
03/02/2021, 5:11 PMTomas Kormanak
03/02/2021, 5:15 PMRobert Jaros
03/02/2021, 5:16 PMRobert Jaros
03/02/2021, 5:27 PMRobert Jaros
03/02/2021, 5:27 PMRobert Jaros
03/02/2021, 5:28 PMRobert Jaros
03/02/2021, 5:29 PM@JsExport
it still won't work with tabulator.Robert Jaros
03/02/2021, 5:33 PMTomas Kormanak
03/02/2021, 5:35 PMRobert Jaros
03/02/2021, 5:36 PMTomas Kormanak
03/02/2021, 5:36 PMRobert Jaros
03/02/2021, 5:38 PMdata class Voice(var _id: Int? = null, var name: String? = null)
// ...
val options = TabulatorOptions(
layout = Layout.FITCOLUMNS,
columns = listOf(ColumnDefinition(tr("Name"), Voice::name.name)),
)
val entities: ObservableList<Voice> = observableListOf()
var counter = 0
root("kvapp") {
tabulator(entities, options = options) {
onEvent {
tabulatorRowClick = { e ->
val entity = (e.detail as io.kvision.tabulator.js.Tabulator.RowComponent).getData()
console.log(entity)
}
}
}
button("add").onClick {
entities.add(Voice(counter, "Name $counter"))
counter++
}
}
Robert Jaros
03/02/2021, 5:40 PM_id
type the only difference?Robert Jaros
03/02/2021, 5:41 PMdata class Id(val id: Int)
and it works fine, tooTomas Kormanak
03/02/2021, 5:43 PMTomas Kormanak
03/02/2021, 5:43 PMTomas Kormanak
03/02/2021, 5:44 PMRobert Jaros
03/02/2021, 5:49 PMRobert Jaros
03/02/2021, 5:50 PMRobert Jaros
03/02/2021, 5:51 PMRobert Jaros
03/02/2021, 5:52 PMTomas Kormanak
03/02/2021, 6:02 PMTomas Kormanak
03/04/2021, 9:52 AMdata class Voice(override val id: Id?, var name: String? = null) : Entity
interface Entity {
val id: Id?
}
Tomas Kormanak
03/04/2021, 10:04 AMgetAllPropertyNames
returns only properties from the parent (in our case implemented interface)
For the example above it returns only one property id
Robert Jaros
03/04/2021, 10:06 AMRobert Jaros
03/04/2021, 1:30 PMRobert Jaros
03/04/2021, 1:32 PM@JsExport
to your data class and interface.Tomas Kormanak
03/04/2021, 1:32 PMTomas Kormanak
03/04/2021, 4:30 PMRobert Jaros
03/04/2021, 5:18 PMRobert Jaros
03/04/2021, 5:24 PMRobert Jaros
03/04/2021, 5:27 PMRobert Jaros
03/04/2021, 5:30 PMId
like yours I've managed to pass the data only from kotlin to js but I can't get it back (e.g. with getData()
)Robert Jaros
03/04/2021, 5:37 PMTabulator.getData()
. I'll just fix the current legacy detection problem and your data should be fully visible in your tabulator tables.
2. I could add a new parameter to the Tabulator
component, which will completely skip current conversions (basicaly revert to 3.16 behavior). Of course it will be usable with legacy backend only.Robert Jaros
03/04/2021, 5:40 PMTomas Kormanak
03/05/2021, 12:52 PMTomas Kormanak
03/05/2021, 1:00 PMdata class User(..... val device:Device)
ColumnDefinition(tr("Device"), "device.name")
Tomas Kormanak
03/05/2021, 1:02 PMRobert Jaros
03/05/2021, 1:04 PMTomas Kormanak
03/05/2021, 1:05 PMRobert Jaros
03/05/2021, 1:07 PMRobert Jaros
03/05/2021, 1:08 PMRobert Jaros
03/05/2021, 1:09 PMRobert Jaros
03/05/2021, 1:10 PMRobert Jaros
03/05/2021, 1:10 PMTomas Kormanak
03/05/2021, 1:12 PMgetdata
function?Robert Jaros
03/05/2021, 1:13 PMgetData
:-)Tomas Kormanak
03/05/2021, 1:14 PMTabulator.RowComponent.getData()
Robert Jaros
03/05/2021, 1:14 PMRobert Jaros
03/05/2021, 1:15 PMTabulator.getData()
Robert Jaros
03/05/2021, 1:15 PMRobert Jaros
03/05/2021, 1:15 PMRowComponent.getData()
is tabulator's internal function.Robert Jaros
03/05/2021, 1:16 PMRobert Jaros
03/05/2021, 1:17 PMRowComponent.getData()
returns kotlinRobert Jaros
03/05/2021, 1:18 PMRobert Jaros
03/05/2021, 1:19 PMRobert Jaros
03/05/2021, 1:19 PMRobert Jaros
03/05/2021, 1:21 PMTabulator.getData()
- in >= 3.17 it will not work with composite structuresRobert Jaros
03/05/2021, 1:22 PMTomas Kormanak
03/05/2021, 1:22 PMRobert Jaros
03/05/2021, 1:23 PMRobert Jaros
03/05/2021, 1:24 PMRobert Jaros
03/05/2021, 1:24 PMRobert Jaros
03/05/2021, 1:26 PMTomas Kormanak
03/05/2021, 1:27 PM