Update the sortBy in initialState of the table when the prop changes #2804
Unanswered
Waqqars987
asked this question in
Q&A
Replies: 2 comments 2 replies
-
I'm also looking for a way to fully control the sortBy state
Would love to know if there is a solution I've missed! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think I got this working!! I pass sort, onSort as props and tie those to the internal sortBy, setSortBy with a couple useEffects
|
Beta Was this translation helpful? Give feedback.
2 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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am passing a "sort" prop from the outisde component to the react table instance as,
When this sort prop changes (somewhere from outside), I want the sortBy in the iniitalState to change and call the my API which is set up using useEffect. It works as it should when click on the table header and sort the columns manually by clicking on it. However, I also want it to change programmatically. At the moment, the prop changes but its not reflected in the table.
Basically, I want to manipulate the initialState of the table when a prop changes. From inside the table, I need automatical sort control provided by the table but I also want to be able to change it from outside.
Can anyone tell me how to achieve this?
Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions