we are using UI GRID to display data and we are using celltemplate in one column to filter data from ID to employee and we have enabled filters for every column.
sampledata:{ID:1 ,salary:3000,Gender:male}
$scope.gridOptions = {
enableFiltering: true,
data:sampledata,
columnDefs: [{Name:Employeetype, Field:ID,
cellTemplate: '<div class="ngCellText"> {{row.entity.ID | ID2EMp}}</div>'}
{Name: salary, field:salary}
{Name:Gender field:Gender}]
}
my filter is something like below:
app.filter('ID2EMp', function() {
return function(text) {
if (text=='1') {
return 'Employee';
}
if (text=='2')
return 'Contractor';
}
});
so now if try to filter grid using UI GRID text filter it wont work if i Type'Employee'/'Contractor' but it will work if i type '1'/'2'..Can anyone please advise how can i make filter work in this situation where i should be able to filter using EMployee keyword.
Also, is there any other way i can manipulate the data to display cell as Employee if ID=1 using filter but not using celltemplate.i have tried with cellfilter but it doesn't seem to work