Ranoy
Ranoy

Reputation: 108

Quick filter in Ag-grid filters on invisible columns too

In ag-grid quick filter feature, it filters on invisible columns too. Is there anyway to avoid this?

Or I should use getQuickFilterText in some way to avoid it?

Plunker:

https://plnkr.co/edit/qhufFspqaevD13gy

export class AppComponent {

    onGridReady(params) {
        this.gridApi = params.api;
        this.gridColumnApi = params.columnApi;
    }
    onFilterTextBoxChanged($event) {
    console.log("yey", $event);
    this.gridApi.setQuickFilter($event);
    }
}

Upvotes: 0

Views: 1692

Answers (1)

Pratik Bhat
Pratik Bhat

Reputation: 7614

You could define getQuickFilterText to each of your column in coldef like this -

      {
        field: 'athlete',
        filter: 'agTextColumnFilter',
        minWidth: 200,
        getQuickFilterText: function(params) {
            if (params.column.visible) {
            return params.value;
            }
        }
      }

Hope this helps!

Upvotes: 2

Related Questions