Reputation: 2356
I'm using react-table with structured data and a default sort using the 'sorted' prop and my custom sort only sorts in the ascending direction.
Please see a demo of this issue here: https://codesandbox.io/embed/react-table-default-sorting-vxe3e
Note that this is different from the more basic demos as the data is structured such that multiple data points can be displayed in each cell. Here I put the 'firstName' and 'lastName' data points inside another object called 'name' so they could conceivably both be displayed in the same cell.
How can I get my custom sort to work in both the ascending and descending directions
Upvotes: 0
Views: 2453
Reputation: 2356
It turns out using the 'sorted' prop is not the proper approach here. I changed this to 'defaultSorted' and it started working in both directions.
Upvotes: 1