The below code is similar to the one in the tutorial http://ui-grid.info/docs/#/tutorial/321_singleFilter but it does not display the data grid and I am not sure why
I checked on plunk and could not find any error, below is my code
var app = angular.module('app', ['ngTouch', 'ui.grid'])
app.controller('MainCtrl', function($scope) {
$scope.gridOptions = {
enableFiltering: false,
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
$scope.gridApi.grid.registerRowsProcessor($scope.singleFilter, 200);
},
columnDefs: [
{
field: 'name'
}, {
field: 'last'
}, {
field: 'address'
}, {
field: 'name1'
}, {
field: 'last1'
}, {
field: 'address1'
}, {
field: 'last45'
}
],
data: [
{
"name": "test",
"last": "test2",
"address": "test3",
"name1": "test",
"last1": "test2",
"address1": "test3",
"last45": "op"
}, {
"name": "test",
"last11": "test2",
"address": "test2"
}, {
"name": "test",
"last": "test2",
"address": "test3"
}, {
"name": "test",
"last": "test2",
"address": "test3"
}, {
"name": "test",
"last": "test2",
"address": "test3"
}, {
"name": "test",
"last": "test2",
"address": "test3"
}, {
"name": "test",
"last": "test2",
"address": "test3"
}
]
};
$scope.filter = function() {
$scope.gridApi.grid.refresh();
};
$scope.singleFilter = function(renderableRows) {
var matcher = new RegExp($scope.filterValue);
renderableRows.forEach(function(row) {
var match = false;
['name', 'last', 'address'].forEach(function(field) {
if (row.entity[field].match(matcher)) {
match = true;
}
});
if (!match) {
row.visible = false;
}
});
return renderableRows;
};
})
ng-click='filter()'does nothing in your plunk. In your example code in your post you haveenableFiltering: false,- Doug E Fresh