选项卡上 ag-grid 中的清除过滤器已更改

Clear filter in ag-grid on tab changed

我有 ag-grid 的默认过滤器和自定义过滤器。我想在选项卡更改时清除过滤器。

$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>'
    };

我试过了,但没用

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

请建议任何方法来重置 ag-grid 的所有过滤器。

试试这个:

$scope.gridOptions.api.setFilterModel(null);
$scope.gridOptions.api.onFilterChanged();