I want to prefill the grid filters. If the column is type of string I found 2 ways to prefill it, but if the column is type of integer i cant prefill the filter.
grid
Code:
features: [
{
ftype: 'filters',
autoReload: true,
local: false
}
],
columns: [
{"text":"ID","dataIndex":"userId",filterable:true}, //model type integer
{"text":"Last name","dataIndex":"lastName",filterable:true,filter:{active:1,value:'abc'}} //model type string
],
listeners: {
afterrender:function(grid){
grid.filters.autoReload = false;
grid.filters.createFilters() ;
grid.filters.clearFilters();
//alternative to define lastName Filter
grid.filters.addFilter({dataIndex:'lastName',value:'abc'});
grid.filters.getFilter('lastName').setActive(true) ;
//How to apply filter to userId? This code does not work
grid.filters.addFilter({dataIndex:'userId',value:'123'});
grid.filters.getFilter('userId').setActive(true) ;
grid.filters.autoReload = true;
}
See the picture how the userId Filter is lookinggridfilter.png
Thx for your help
Mike