Replies: 1 comment
-
This is how I got it working - any comments welcome: const {
state: tableState,
toggleSortBy,
getTableProps,
getTableBodyProps,
headerGroups,
rows,
prepareRow,
} = useTable(
{
columns,
data,
initialState: { sortBy: useMemo(() => [{ id: 'lastName' }], []) },
},
useSortBy
);
...
useEffect(() => {
if (!tableState.sortBy.length) {
toggleSortBy('lastName');
}
}, [tableState, toggleSortBy]); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Using v7, how would I implement following use case:
I would like to get data sorted by Column A again as soon as sorting of Column B is not ASC or DESC.
Any ideas welcome!
Thanks!
Mike
Beta Was this translation helpful? Give feedback.
All reactions