0
votes

I have an angular ui grid which has external filters and column filters. I'm using rowsProcessor while applying external filter and also while resetting the external filter.

I'm using this command for resetting the filters.

$scope.gridApi.grid.registerRowsProcessor( $scope.DisplayAll, 200 );

$scope.DisplayAll = function( renderableRows ){
renderableRows.forEach( function( row ) {
              row.visible = true;

                });
            return renderableRows;
}

Once this is done, the grid is populated with all the data but the column filters present in the grid aren't working. Can anyone explain why this is happening. Thanks!

1

1 Answers

0
votes

Short answer: having a "display all" filter as a rowsProcessor filter does not make a lot of sense, since it will run after every filtering cycle and override everything applied before it.

Here's some further description of the problem:

You have told DisplayAll to run at a priority of 200 in the grid, which means all filters applied before it (which includes the built-in column filters) are being overriden with row.visible = true;.

If a column filter (which is being run at priotiry 100) determines that a row should not be displayed it will set row.visible = false;. After that happens, when DisplayAll encounters that row, it will change row.visible = true; thus ignoring the column filter.

Any rowsProcessor filter that is added should account for previously applied filters by doing something such as row.visible = row.visible && <new condition>.