Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear filter in ag-grid on tab changed

I have default filter and custom filter for ag-grid . I want to clear filter on tab change.

$scope.gridOptions = {
        columnDefs: columnDefs,
        rowData: null,
        angularCompileRows: true,
        enableSorting: true,
        enableColResize: true,
        enableFilter: true,
        rowHeight: 35,
        rowSelection: 'single',
        onSelectionChanged: onSelectionChanged,
        isExternalFilterPresent: isExternalFilterPresent,
        doesExternalFilterPass: doesExternalFilterPass,
        overlayLoadingTemplate: '<span class="ag-overlay-loading-center">Please wait while your rows are loading</span>',
        overlayNoRowsTemplate: '<span style="    transform: translateY(-50%);opacity: 0.25;font-size: 3em;">No data available</span>'
    };

I tried this but it's not working

    $scope.gridOptions.api.resetFilters();
$scope.gridOptions.api.destroyFilter();

Please suggest any method to do reset all filters of ag-grid.

like image 807
anagha affinity Avatar asked Jun 03 '16 06:06

anagha affinity


1 Answers

Try this:

$scope.gridOptions.api.setFilterModel(null);
$scope.gridOptions.api.onFilterChanged();
like image 169
Alexander Zbinden Avatar answered Nov 02 '22 04:11

Alexander Zbinden