简体   繁体   English

按数字输入过滤器不起作用

[英]Input Filter by number not working

I have a filter which must return what I've entered in "input" 我有一个过滤器,该过滤器必须返回在“输入”中输入的内容

  filterAmount(e) { var value = e.target.value; this.setState({ filteredAmounts: !value ? false : this.props.items.filter(function(item) { return item.income_amount ; }) }) } 
 <input onChange={this.filterAmount.bind(this)} type='text' placeholder='amount search'></input> 

But, now when I enter any value, my table with results disappears. 但是,现在当我输入任何值时,带有结果的表就会消失。 For example. 例如。 I have value with "0" I entered "0" to input and all table disappears. 我的值为“ 0”,输入了“ 0”,所有表都消失了。 What is the correct way to return to filter? 返回过滤器的正确方法是什么?

在此处输入图片说明

I use it with react, there full code https://plnkr.co/edit/UGXuK1AMvibVRw1zvIfD?p=catalogue 我将它与react一起使用,有完整的代码https://plnkr.co/edit/UGXuK1AMvibVRw1zvIfD?p=catalogue

  return  item.income_amount == value ; Helps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM