EasyUI Forum

General Category => EasyUI for React => Topic started by: chrwei on October 09, 2019, 07:30:20 AM



Title: grid filters affecting other grids
Post by: chrwei on October 09, 2019, 07:30:20 AM
I'm experiencing an issue when using multiple grid where a filter on one grid is affecting another grid, even if that other grid does not have "filterable" property set, and even if I navigate to another route.  problem is, these other grid have no indication that a filter is applied and no way to clear it. besides reloading the page.

I'm simply putting the "filterable" property on a grid, then in one column I have a LinkButton that opens a Dialog which has a simple grid with completely different data in it. that simple grid is also having the first grid's filter applied, which of course matches nothing.

am i doing something incorrectly with having multiple grids?


Title: Re: grid filters affecting other grids
Post by: jarry on October 09, 2019, 08:06:58 PM
This is the simple way to get the filtered data and bind on the other grid.
1. Listen to the 'onFilterChange' event and then get the filtered data.
2. Bind this data on the other grid.
Code:
<DataGrid 
  ref={ref=>this.dg=ref}
  style={{ height: 250 }}
  filterable
  data={this.state.data}
  onFilterChange={this.handleFilterChange.bind(this)}
>
Code:
  handleFilterChange(filterRules){
    this.setState({filterRules})
    this.setState({otherData: this.dg.filteredData})
  }


Title: Re: grid filters affecting other grids
Post by: chrwei on October 11, 2019, 12:55:30 PM
I think you misunderstand. 

the filter itself is applying to other grids.  I don't want it to.