-
Hey @rwieruch -- great library you've created here! Question: in sorting, is it possible to obtain the index or name of the column clicked for sorting? Context: I'm working with data where I don't know the columns up-front, so I'm trying to implement generic sorting based on the data type of the column. All of the existing examples use dedicated
where Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yes. Usually you have to write sortFns for each column. What may help is defining the columns as an array and then using this array to create the sortFns on the fly:
And in your useSort hook:
Does this help? |
Beta Was this translation helpful? Give feedback.
-
A variant of this worked perfectly, thank you! |
Beta Was this translation helpful? Give feedback.
Yes. Usually you have to write sortFns for each column. What may help is defining the columns as an array and then using this array to create the sortFns on the fly:
And in your useSort hook: