Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom sort method for column in ReactTable

Tags:

reactjs

I want to make a custom sort method for a column in my ReactTable. How can I say to ReactTable that it should use my custom sort method instead?

I can not see how I am supposed to use sortMethod property on the column. When I pass this:

sortMethod: (prop1, prop2, prop3) => console.log(prop1, prop2, prop3); //undefined undefined false

So I guess that the prop3 says false because it is not desc. However, what about the prop1 and prop2? should it not be something? One reason can be that I only have an id on the column, and no accessor?

like image 223
RMT Avatar asked Nov 17 '22 15:11

RMT


1 Answers

React-table returns undefined for props1 and props2 due to unavailability of accessor key in column props.

https://www.npmjs.com/package/react-table#columns

like image 112
Faiyaz Shaikh Avatar answered Feb 12 '23 17:02

Faiyaz Shaikh