React-virtualized: sorting and filtering support

Created on 12 Apr 2017  路  1Comment  路  Source: bvaughn/react-virtualized

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?

question

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings