How do I set the default column to sort?
Hi, I'm making a table for a log of user infractions and im wondering how I can make the items sorted by the caseId in a descending
My code is as above for defining the columns.
2 Replies
fascinating-indigo•3y ago
Hi.
You'll actually want to set initial sorting state when you make your call to
useReactTable()
.
For example, my call to useReactTable()
looks something like this:
The state
property is what you are interested in. sorting
should be something like:
Where each object is the column that you want to sort by, id
is the accessor for that column, and desc
is a true/false
based on whether you want to sort in descending order or not.
The order in which you list your column objects in that array is the order in which they will be sorted.flat-fuchsiaOP•3y ago
alright
thank you