javascript - how to filter all columns of html table using react js? - Stack Overflow

I am creating custom data table. I have added sorting, pagination but unable to do searching on all col

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 badges
Add a ment  | 

1 Answer 1

Reset to default 6

You 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 => {

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745615771a4636226.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信