Skip to content

How can I persist the sortBy state of a Table between mounts? #826

Answered by veej
mperrando asked this question in Q&A
Discussion options

You must be logged in to vote

I understood your use case.
My solution at the moment is:

  1. use onSort to store the current sorting, e.g. on the parent component (since you want to persist it during unmounts / remounts)
  2. pass the initialSorting for when the Table is mounted again
  3. use lodash.orderby to sort the data based on the current sorting stored on point 1

I am missing something? Isn't this solution working as you expect?

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mperrando
Comment options

@veej
Comment options

Answer selected by veej
@mperrando
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants