Currently, I am utilizing $filter to perform filtering on my array.
var filteredData = params.filter() ?
$filter('filter')($scope.myNgTable.data, params.filter()):
$scope.myNgTable.data;
I have implemented a multiple select filter for filtering, however, it returns an array: col: ["a","b"], which seems incompatible with $filter according to my observation.
What I desire is that when the filter is col: ["a","b"], it should display all rows where col contains "a" or col contains "b". (Alternatively, if there's only a way for equal comparison, such as: col == "a" or col == "b")
Can this be achieved?
Response:
.filter("in_Array", function ($filter){
return function(data, filter){
var out = [];
$.each(filter, function(key,val) {
var obj = {};
for(var i=0;i<val.length;i++) {
obj[key] = val[i];
var tmp = $filter('filter')(data, obj);
out = $.unique($.merge(out, tmp));
}
});
return out;
};
});