简体   繁体   中英

modify grid-data for external filter in ng-grid angularJS

I have to modify data of grid based on external generic filter for data grid. I have searched and find out 2 ways to do so,

  1. After changing grid data according to filter, use $scope.gridApi.core.notifydatachange(uiGridConstants.dataChange.ALL)

  2. add $scope.gridApi.grid.registerRowsProcessor( $scope.singleFilter, 200 ); in $scope.gridOptions.onRegisterApi and then inside $scope.singleFilter function change visibility of data according to filter.

Is it possible to filter data according to external filter and column filter together?

If YES, I want to know which method will go very well with column filtering?

It is good idea to modify data for filter using $scope.gridApi.core.notifydatachange(uiGridConstants.dataChange.ALL) function. As $scope.gridApi.grid.registerRowsProcessor() is used by ng-grid internally for single column filter. And hence if we try to modify it, By default functionality of column filter will behave un-expectedly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM