Hildebrandt Tobias
01/29/2025, 11:34 AMColumnDefTemplate { info ->
if(info.row.getIsPinned() == RowPinningPosition.`false` && info.row.original.materialNumber == rememberPin)
info.row.pin(RowPinningPosition.top, false, false)
info.getValue()
}
turansky
01/29/2025, 12:25 PMinfo.row.pin
during render and force rerenderHildebrandt Tobias
01/29/2025, 12:25 PMuseEffect(rememberPin) {
productionMaterialTable
.getRowModel()
.rowsById
.toPairList()
.firstOrNull { (_, row) ->
row.original.materialNumber == rememberPin
}
?.second?.pin(<http://RowPinningPosition.top|RowPinningPosition.top>, false, false)
}
But to no availHildebrandt Tobias
01/29/2025, 12:26 PMturansky
01/29/2025, 12:26 PMHildebrandt Tobias
01/29/2025, 12:28 PMprops
for example, or for simplicity could just be "pin where materialNumber = 200".turansky
01/29/2025, 12:29 PMuseTable
option should contain "isPinned" record (it already contains "isSelected" record)turansky
01/29/2025, 12:34 PMHildebrandt Tobias
01/29/2025, 12:35 PMTableOptions
in useReactTable
don't provide "isPinned"Hildebrandt Tobias
01/29/2025, 12:36 PMHildebrandt Tobias
01/29/2025, 12:38 PMuseReactTable<T>(
options = jso {
val (expanded, setExpanded) = userSettings.expanded
val (sorting, setSorting) = userSettings.sorting
val (grouping, setGrouping) = userSettings.grouping
val (columnVisibility, setColumnVisibility) = userSettings.columnVisibility
val (globalFilter, setGlobalFilter) = userSettings.globalFilter
val (columnFilters, setColumnFilters) = userSettings.columnFilters
val (showFilters, setShowFilters) = userSettings.showFilters
val (currentPage, setCurrentPage) = userSettings.page
// val (rowPinning, setRowPinning) = userSettings.rowPinning
val (currentRowsPerPage, setCurrentRowsPerPage) = userSettings.rowsPerPage
this.data = data ?: emptyArray()
this.columns = columns
this.state = jso {
// this.rowPinning = userSettings.rowPinning.component1()
this.expanded = userSettings.expanded.component1().unsafeCast<ExpandedState>()
this.sorting = userSettings.sorting.component1()
this.grouping = userSettings.grouping.component1()
this.columnVisibility = userSettings.columnVisibility.component1().toRecord()
this.globalFilter = userSettings.globalFilter.component1()
this.columnFilters = userSettings.columnFilters.component1()
}
[...]
You mean here at the this.state
?turansky
01/29/2025, 12:39 PMval table = useTable()
// call table methods
// (pseudocode)
table.state.setPinned(...)
//
// render
turansky
01/29/2025, 12:41 PMHildebrandt Tobias
01/29/2025, 12:45 PMHildebrandt Tobias
01/29/2025, 12:46 PMRowPinningState
expects a rowId in top
Hildebrandt Tobias
01/29/2025, 12:47 PMdata
of the table?turansky
01/29/2025, 12:53 PMHildebrandt Tobias
01/29/2025, 12:53 PMHildebrandt Tobias
01/29/2025, 12:54 PMturansky
01/29/2025, 12:56 PMHildebrandt Tobias
01/29/2025, 12:57 PMHildebrandt Tobias
01/29/2025, 1:03 PMval productionMaterialTable =
defaultTableOptions(
productionMaterials,
productionMaterialColumns,
materialTableUserSettings
) {
keepPinnedRows = true
enablePinning = true
this.getRowId = { row, _, _ ->
row.materialNumber.value.toString()
}
}
setRowPin(jso<RowPinningState> {
top = arrayOf(rememberPin.value.toString())
})
Hildebrandt Tobias
01/29/2025, 1:15 PMval productionMaterialTable =
defaultTableOptions(
productionMaterials,
productionMaterialColumns,
materialTableUserSettings
) {
keepPinnedRows = true
enablePinning = true
this.getRowId = { row, _, _ ->
row.materialNumber.value.toString()
}
}
useEffect(rememberPin) {
println(rememberPin)
if(rememberPin.value >= 0) {
println("SET PIN")
setRowPin(jso<RowPinningState> {
top = arrayOf(rememberPin.value.toString())
bottom = arrayOf()
})
}
}
Hildebrandt Tobias
01/29/2025, 1:15 PMuseEffect
Hildebrandt Tobias
01/29/2025, 1:25 PMval productionMaterialTable =
defaultTableOptions(
productionMaterials,
productionMaterialColumns,
materialTableUserSettings
) {
keepPinnedRows = true
enablePinning = true
if(rememberPin.value >= 0) {
state.rowPinning = jso<RowPinningState> {
top = arrayOf(rememberPin.value.toString())
bottom = arrayOf()
}
}
this.getRowId = { row, _, _ ->
row.materialNumber.value.toString()
}
}
Hildebrandt Tobias
01/29/2025, 1:25 PM