T
TanStack2y ago
extended-salmon

ColumnOrder, ColumnPinning, ColumnVisibility

Hi. I'm using 8.8.5 version of tanstack/react-table. I have a bug with columOrder, columnPinning and columnVisibility; When I'm not using id in columnDef and using accessorKey my columnOrder is shuffled. And it's shuffled exactly when some columns have accessorKey like someKey and others have some.key. In my component I have a mapper that takes all accessorKeys and sets them into useTable state. As a result - expected order is not applied, columns have shuffle order. If I change accessorKey to one format - everything works as expected. When I'm using id in any format - everything works as expected. Is there any way to use accessorKey with different formats so all the logic will be properly applied?
1 Reply
foreign-sapphire
foreign-sapphire2y ago
Just stumbled accross this issue as well... That's because the id internaly is not exactly like the accessorKey (some.key -> some_key). Use table.getAllLeafColumns()

Did you find this page helpful?