admin管理员组文章数量:1433509
I am creating custom data table. I have added sorting, pagination but unable to do searching on all columns. Here is the URL of what i have created
Data array contains uppercase words and integers.
How to implement filter/search on all columns using single input box?
I am creating custom data table. I have added sorting, pagination but unable to do searching on all columns. Here is the URL of what i have created
https://codesandbox.io/s/yv48o7onwj
Data array contains uppercase words and integers.
How to implement filter/search on all columns using single input box?
Share Improve this question asked Jun 26, 2018 at 4:51 Sameer ThiteSameer Thite 2,4693 gold badges12 silver badges13 bronze badges1 Answer
Reset to default 6You can do it using Array.filter
const filtered = products.filter(item => (
item.id === searchString ||
item.name === searchString ||
item.price === searchString ||
item.qa === searchString ||
item.qr === searchString ||
item.vendor === searchString
));
and then replace {products.map(item => {
on line 326 to {filtered.map(item => {
本文标签: javascripthow to filter all columns of html table using react jsStack Overflow
版权声明:本文标题:javascript - how to filter all columns of html table using react js? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745615770a2666391.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论