With a table like this
1|2|3
4|1|1
1|1|1
Now I want to filter by columns with numbers >=3, I would get:
1|2|3
4|1|1
The ClientFilter library seems to only be made for strings (regex implementation). Is there an alternate way of doing this?
With a table like this
1|2|3
4|1|1
1|1|1
Now I want to filter by columns with numbers >=3, I would get:
1|2|3
4|1|1
The ClientFilter library seems to only be made for strings (regex implementation). Is there an alternate way of doing this?
Backgrid classes are easily extensible, so all you need to do is create your own filter class which overrides ClientSideFilter.makeMatcher
function like so:
var GreaterThanClientFilter = Backgrid.Extension.ClientSideFilter.extend({
makeMatcher: function(query){
var q = 1*query;
return function (model) {
if (isNaN(q)) return false;
var keys = this.fields || model.keys();
for (var i = 0, l = keys.length; i < l; i++) {
value = model.get(keys[i]);
if (!isNaN(value) && (1*value >= q))
return true;
}
return false;
};
}
});
var filter = new GreaterThanClientFilter({
collection: collection
});
Running example: JSFiddle