Using the Table and Column components of react-virtualized
, I have achieved a default sort column and direction by defining a sortBy
dataKey and the sortDirection
in the Table component. I have another column, which I would like to have sort in descending order (instead of the default ascending order) the first time a users clicks it, but can't see how to do this. Is it possible to have a default sort direction per Column?
Update: I don't want to sort columns simultaneously, but instead want to have different sort directions for each column when sort is first implemented per column. For example, I want to start the defaults for my table to be sorted by lastname in ascending order. However, I have a few other columns that hold integers or booleans, and that I would like to sort in descending order when the user first clicks on those columns. In ascending order, those columns would first display false and 0's (if any), but would be more meaningful if they were first sorted with true or a set's upper numbers. I'm trying to slightly improve the user experience as to not have to click twice on the columns to get a descending order.