T
TanStack3y ago
foreign-sapphire

How to properly use columnOrder in the useTable hook

Hi, I'm trying to set the columnOrder in the useTable hook according to this info from the docs: Table Options The following options are supported via the main options object passed to useTable(options) initialState.columnOrder: Array<ColumnId> Optional Defaults to [] Any column ID's not represented in this array will be naturally ordered based on their position in the original table's column structure So in my useTable I have something like this, however this doesn't do change the order I have? The columnIds are the accessors defined in the columns.
const tableInstance = useTable(
{
columns,
data,
initialState: {
columnOrder: ["column2", "column1"],
},
},
useSortBy
);
const tableInstance = useTable(
{
columns,
data,
initialState: {
columnOrder: ["column2", "column1"],
},
},
useSortBy
);
1 Reply
foreign-sapphire
foreign-sapphireOP3y ago
Ok, so I noticed that I was on v7, refactored to v8 and it's working now.

Did you find this page helpful?