UNuX
09/02/2021, 1:28 PMval tabulatorRowIndex = ((event.detail as io.kvision.tabulator.js.Tabulator.RowComponent).getIndex() as Int) - 1
But on the third its failing on cast exceptionRobert Jaros
09/02/2021, 1:35 PMgetIndex()
and getPosition()
Robert Jaros
09/02/2021, 1:35 PMgetIndex()
returns the value of the index column in your data (by dafault id
column)Robert Jaros
09/02/2021, 1:36 PMid
the cast will failRobert Jaros
09/02/2021, 1:37 PMgetPosition()
UNuX
09/02/2021, 1:50 PMsetEventListener<Tabulator<SystemUser>> {
rowClickTabulator = { event ->
val casted = (event.detail as io.kvision.tabulator.js.Tabulator.RowComponent).getData()
println("Data: $casted")
val model = casted as SystemUser
it breaks down at the last line in this snippet, it's supposed to give me the SystemUser object thats represented in the clicked row, right?UNuX
09/02/2021, 1:51 PMRobert Jaros
09/02/2021, 1:51 PMRobert Jaros
09/02/2021, 1:52 PMRobert Jaros
09/02/2021, 1:52 PMRobert Jaros
09/02/2021, 1:54 PMRobert Jaros
09/02/2021, 1:54 PMRobert Jaros
09/02/2021, 1:56 PMRowComponent
or CellComponent
) you will get only plain JS objects.Robert Jaros
09/02/2021, 1:58 PMRobert Jaros
09/02/2021, 1:58 PMUNuX
09/02/2021, 2:00 PMRobert Jaros
09/02/2021, 2:00 PMUNuX
09/02/2021, 2:01 PMRobert Jaros
09/02/2021, 2:05 PMMiguel Vera Belmonte
01/24/2023, 6:13 PMRobert Jaros
01/24/2023, 7:44 PMtoKotlinObjTabulator
method. But since KV6 Tabulator supports only serializable data classes, so this method just deserializes the plain js data to Kotlin class using tabulator internal serializer.Miguel Vera Belmonte
01/26/2023, 8:29 PMDušan Salay
05/05/2023, 2:23 PMtabulator.onEvent {
rowClickTabulator = { event ->
val rowComponent = event.detail as Tabulator.RowComponent
val rowIndex = rowComponent.getPosition() as Int - 1
val data = tabulator.getData(RowRangeLookup.VISIBLE)?.get(rowIndex) as UniversityEvent
console.log(data)
console.log(data.name)
}
}
but I am receiving ClassCastException
Can you advice me what I am doing wrong?
Is my approach even correct?
Thanks, in advance for your help!Robert Jaros
05/06/2023, 5:44 AMRobert Jaros
05/06/2023, 5:46 AMDušan Salay
05/06/2023, 1:07 PMDušan Salay
05/06/2023, 1:10 PMTabulatorRemote
and with those modules:
startApplication(
::App,
module.hot,
BootstrapModule,
BootstrapCssModule,
DatetimeModule,
BootstrapIconsModule,
CoreModule,
FontAwesomeModule,
TabulatorCssMaterializeModule
)
not sure if adding TabulatorModule
is also necessary?Dušan Salay
05/06/2023, 1:16 PMRobert Jaros
05/06/2023, 2:14 PMval tabulator = TabulatorRemote(...)
Robert Jaros
05/06/2023, 2:14 PMval tabulator = tabulatorRemote()
Robert Jaros
05/06/2023, 2:14 PMRobert Jaros
05/06/2023, 2:16 PMkClass: KClass<T>
parameter manually)Dušan Salay
05/06/2023, 4:40 PMtabulatorRemote()
helped!