onRegisterApi: function(gridApi){
$scope.gridApi.grid.registerRowsProcessor( $scope.singleFilter, 200 );
}
html
<input type="text" placeholder="名称" ng-model="filterValue" ng-enter="filter()"/>
$scope.filter = function () {
$scope.gridApi.grid.refresh();
};
$scope.filterValue = ""
$scope.singleFilter = function (renderableRows) {
var matcher = new RegExp($scope.filterValue, 'i');
renderableRows.forEach(function (row) {
var match = false;
['name'].forEach(function (field) {
if (row.entity[field].match(matcher)) {
match = true;
}
});
if (!match) {
row.visible = false;
}
});
return renderableRows;
}
网友评论