Its my first post, so i may be posting in wrong thread, sorry for that.
I would like to restrict negative values in numeric grid filter, allowing only positive numbers in numeric filter in grid, I am not able to find how to do this.
here is my code
var myFilters =
{
ftype : 'filters',
encode : false,
local : false,
extend : 'Ext.data.Model',
filters :
[
{
type : 'numeric',
dataIndex : 'utilization_per'
}
]
};
deviceUtilGridPanel = new Ext.grid.GridPanel(
{
features : [myFilters],
columns :
[
{id:'ru_utilization_per', header: "Utilization(%) (U)", sortable: true, dataIndex: 'utilization_per', filterable: true, filter :{type:'numeric'},width:80}
]
});
Any help will be greatly appreciated.
Thanks in advance.
You can use the menuItemCfgs
config on the filter to modify the form field used by the filter menu.
var myFilters = {
ftype: "filters",
encode: false,
local: false,
filters: [{
dataIndex: "utilization_per",
type: "numeric",
menuItemCfgs: {
minValue: 1 // Or 0, or whatever you want
}
}]
};
As a side note (not really related to the answer), your code has a few issues with it. You don't need to add extend
to your filter config because you're not extending it, and it doesn't need to know about your models. The header
config in your column definition has been deprecated in favor of text
which does the same thing. Columns are filterable by default so you don't need filterable: true
. And if you specify your column filter in the filter feature config, you don't need to specify it on the column level.