react-virtualized icon indicating copy to clipboard operation
react-virtualized copied to clipboard

sorting and filtering support

Open mauvew opened this issue 9 years ago • 1 comments

Thanks for creating react-virtualized!

Are there any plan for adding sorting and filtering features for the Grid or MultiGrid like fixed-data-table used to provide?

mauvew avatar Apr 12 '17 14:04 mauvew

Table doesn't really provide sorting (and it definitely doesn't provide filtering). Table just provides clickable headers that call back to your application's own sort methods. Then you re-sort your own data and RV just displays it.

This is pretty light-weight and could be added onto a Grid or MultiGrid pretty easily. Basically if the rowIndex param passed to your cellRenderer is 0 then add click handlers that call a sort function. 😁 The only other thing you'd need to do is let Grid know the data order has changed. I wrote a couple of slides about that specifically! There's also this section of the docs.

As for filtering, all RV components can display filtered data- but no filtering is done by RV. (There are just too many ways to filter data. I do have some libraries that might help with this though- depending on what you're doing: js-search, js-worker-search, redux-search). All you need to do as far as RV's concerned is give it the total number of items (taking into consideration any of your current filter criteria) and map an index to an item (if your filtered set). It works the same.

bvaughn avatar Apr 12 '17 15:04 bvaughn