React-table: Global filter

Created on 17 Sep 2019  路  13Comments  路  Source: tannerlinsley/react-table

Please Consider adding the ability to setFilter with a column id that is not represented in the table.

Use Case:
Global filter input that can be used with setFilter function along with other filters in the table.
Right now i need to create a dummy column in order to use the setFilter function.
It can be nice if i could pass a flag to the function setFilter that indicates if the column is not represented in the table.

Feature Request High

Most helpful comment

I think you're right. I'll start thinking on how this could fit into the API. Stay tuned.

All 13 comments

A global filter option would be clutch. Here's what a common use case looks like.

image

I think you're right. I'll start thinking on how this could fit into the API. Stay tuned.

Whats the status update for this feature ?

A global filter would be fantastic! Our use case is quite similar to the ones already requested. Being able to pair a global filter with something like Fuse.js (https://fusejs.io) for weighting and fuzzy matching would be fantastic for a lot of search use cases.

@wpapper i think so you can use material UI for react to add this feature https://material-ui.com/components/tables/

I also need such a plugin! Will this be released soon?馃槏

This is now available!

7.0.0-rc.15

  • Added useGlobalFilter hook for performing table-wide filtering
  • Filter function signature has changed to supply an array of column IDs (to support both the tranditional single column style and the new multi-column search style introduced with useGlobalFilter).
  • Removed the column parameter from the filter function signature as it was unused and no longer made sense with the array of IDs change above.
  • Updated the filtering example to use a global filter in addition to the column filters

@tannerlinsley thank you so much

@tannerlinsley MAN, you are amazing! thx :D

Fantastic, could you updated @types/react-table
useTable function with missing

    const {
        getTableProps,
        getTableBodyProps,
        headerGroups,
        rows,
        prepareRow,
        state,
      ->   preGlobalFilteredRows,
      ->   setGlobalFilter,
    } = useTable(
        {
            columns,
            data,
            defaultColumn,
        },
        useFilters,
        useGlobalFilter
    );

Fantastic lib btw!!!

@bartoszgolebiowski Feel free to submit a PR to the types repo. Those types are 3rd party and not tracked or maintained here.

hello, global filter not proper working plz any suggestion?

For anyone looking for types for the filtering properties from useTable, here is a link for a type definition file https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-table

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mlajszczak picture mlajszczak  路  3Comments

dilipsundarraj1 picture dilipsundarraj1  路  3Comments

krishna-shenll picture krishna-shenll  路  3Comments

danielmariz picture danielmariz  路  3Comments

dwjft picture dwjft  路  3Comments