How to filter the data using checkbox in aggrid table using reactjs

一笑奈何 提交于 2019-12-23 04:49:07

问题


How to filter the data while checking multiple checkbox in grid table? when I am selecting checkbox in the filter it should filter the data based on checkbox value. But am not able to filter the data when am checking multiple checkbox. Initially I tried for single checkbox filter it works fine.

 ScaleChoiceFilter(value) {
    console.log(value);
    let newValue = this.state.text;
    newValue.push(value);   
    this.setState(
      {
        text: newValue
      },
      () => {
         this.props.filterChangedCallback();
            }
       );


        }


   doesFilterPass(params) {
return this.state.text
  .toLowerCase()
  .split(" ")
  .every(filterWord => {
    return (
      this.valueGetter(params.node)
        .toString()
        .toLowerCase()
        .indexOf(filterWord) >= 0
    );
  });}


     in return am defining like this
   <div>
  {this.state.scaleFilterValue.map((scaleValue, index) => (
        <ul>
          <input
            type="checkbox"
            onChange={e => this.ScaleChoiceFilter(scaleValue)}
            style={{
              marginTop: 3
              //   verticalAlign: "top"
            }}
          />{" "}
          {scaleValue}
        </ul>
      ))}
  </div>

Expected Result: On clicking checkbox it should filter the data.

Actual Result: Filter is not working for multiple checkbox in grid table

来源:https://stackoverflow.com/questions/57292008/how-to-filter-the-data-using-checkbox-in-aggrid-table-using-reactjs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!