ng-grid get filtered column count after filtering

Posted by Ryan Langton on Stack Overflow See other posts from Stack Overflow or by Ryan Langton
Published on 2014-06-03T15:23:46Z Indexed on 2014/06/03 15:24 UTC
Read the original article Hit count: 363

Filed under:
|

I'm using ng-grid with filtering. Any time the filter updates I want to get the filtered item count. I have been able to do this using the filteredRows property of ngGrid. However I'm getting the rows BEFORE the filtering occurs and I want them AFTER the filtering occurs. Here is a plunker to demonstrate the behavior: http://plnkr.co/edit/onyE9e?p=preview

Here is the code where filtering is occuring:

$scope.$watch('gridOptions.filterOptions.filterText2', function(searchText, oldsearchText) {
      if (searchText !== oldsearchText) {
        $scope.gridOptions.filterOptions.filterText = "name:" + searchText + "; ";
        $scope.recordCount = $scope.gridOptions.ngGrid.filteredRows.length;
    }
});

© Stack Overflow or respective owner

Related posts about angularjs

Related posts about ng-grid