1
votes

I have several ag grids I'm working with that are setup as Master/Detail. I have an external filter setup on the master and that works fine I can extend it to the detail grid but running into a couple issues:

  1. The filter appears to only apply to expanded nodes. Closing and reopening resets the data, though the filter may still have a value.
  2. I haven't figured out a way for the filter to ignore the master if the filter matches detail but not the master.
  3. How I expand the master where the detail matches. I think I will need to use a a timeout so that the grid isn't expanding and collapsing on each key press, but I don't know how to know which grid has matching data.

The code below is what I have so far for just handling the detail grid but this appears to be very slow (plunker: https://next.plnkr.co/edit/S1PNvugCbjPh55jI).

onFilterTextBoxChanged() {
      // this.gridApi.setQuickFilter(document.getElementById('filter-text-box').value);

      this.gridApi.forEachNode(function(node) {
        console.log('node.detailNode', node)
          node.gridApi.forEachDetailGridInfo(function(detailGridApi){
            console.log('detailGridApi', detailGridApi);
          detailGridApi.api.setQuickFilter(document.getElementById('filter-text-box').value);
        })
      });
  }
1

1 Answers

0
votes

Just a suggestion, on each keypress event happening on the filter box ->

1) Before calling quickFilter function, Expand all the detail grid using grid event expandOrCollapse because it somehow does the filtering while its in expanded state.

2) Collapse the grid when search filter box is empty and have cross mark to empty it.

Please ignore if it does not suits ur needs. Thanks!