React-table: Filter search term highlight

Created on 8 Oct 2019  Â·  3Comments  Â·  Source: tannerlinsley/react-table

Please add ability to highlight text matched by filter similar to search result highlighting in data tables. datatables.net/blog/2014-10-22

Most helpful comment

It is possible to get the current filters state — both for the regular filters and for the global filter — inside the Cell method of the columns options.

They're available inside the state, so for the global filter we can get it like this (imagine this being inside the columns definition and having a highlight function that would do the work for you):

Cell: ({ cell: { value }, state: { globalFilter } }) => highlight(value, globalFilter)

All 3 comments

This has already been requested in #1527. We'll track it there. Thanks!

Hey, just implemented the global search but I'm not seeing anything regarding highlighting in issue #1527

It is possible to get the current filters state — both for the regular filters and for the global filter — inside the Cell method of the columns options.

They're available inside the state, so for the global filter we can get it like this (imagine this being inside the columns definition and having a highlight function that would do the work for you):

Cell: ({ cell: { value }, state: { globalFilter } }) => highlight(value, globalFilter)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mellis481 picture mellis481  Â·  3Comments

bdkersey picture bdkersey  Â·  3Comments

missmellyg85 picture missmellyg85  Â·  3Comments

Abdul-Hameed001 picture Abdul-Hameed001  Â·  3Comments

dwjft picture dwjft  Â·  3Comments