Reputation: 13509
I am trying to apply a numeric filter to a numeric column in a grid using the filterfeature in extjs. I do this by setting a values on my filter using filterdata stored in the grid.
var filterData = tablePanel.filters.getFilterData();
Ext.Array.each(filterData, function (filter) {
try {
var aFilter = tablePanel.filters.filters.getByKey(filter.field)
aFilter.setValue(filter.data.value)
}
catch (err) {
Util.logError('err ' + err)
}
})
The construct looks a bit weird, but it is a hack which solves this bug :
How do I apply filter in ExtJS
This works perfectly if my filters are just plain old string filters, but when I have a numeric filter it throws an exception with this message :
message: "Cannot use 'in' operator to search for 'lt' in 19938" stack: (...)
The error is thrown on this line :
aFilter.setValue(filter.data.value)
But the objects in question look OK :
aFilter
filter
Why can't I apply numeric filters?
Upvotes: 0
Views: 967
Reputation: 2289
To filter numeric values. you have to provide comparison operator (lt , gt, eq)
e.g to filter id which equals 3
var f = insidegrid.filters.getFilter('id');
f.setValue({eq:3D});
f.setActive;
Upvotes: 1