filter search box returns prematurely when cell contains an object
I have an app where I put objects in each row for a particular column. When I type into the search box, the filter function returns prematurely when it can't find a match in the sub-fields of that object. The line of code is here:
https://github.com/angular-ui/ng-grid/blob/8017eee035ac21ce9989eb26ea5dc6c13b9553cd/build/ng-grid.debug.js#L2487
The snipped is here:
var pVal = item[prop];
if(typeof pVal === 'object'){
return searchEntireRow(condition, pVal, c); // <<---
} else { /* */ }
I think line marked with // <<--- should be replaced with:
if (searchEntireRow(condition, pVal, c)) {
return true;
}
That way, if the recursive call finds a match it short circuits, but if it doesn't it continues to examine the other columns. I tried it in my local copy and it appears to do the right thing.
Geoff
I'll back this issue. My dataset contains nulls for certain values which breaks the filtering function for me. I dynamically have to reassign empty strings to all null values which is just ugly IMO. Any chance this can get fixed for 2.0.8 or 3?
@geoffhardy - Thanks, that worked for me as well.
Hi,
I want to filter the rows in a ng-grid table which has a column with null value. what should be my textString for the same ?
$scope.filterOptions = { filterText: "" };
$scope.gridOptions = { data: 'ctrl.titles', filterOptions: $scope.filterOptions }
$scope.filterOptions.filterText = "
I am not able to get the rows which has null for a certain field.
Thanks in advance for helping out with this issue.