PDA

View Full Version : Activating two filters at the same time



ipavlic
23 Mar 2012, 7:20 AM
I have the following code to filter a grid from values inputed in a form on a click of a button. The problem is that the first time the filters are activated, only the first filter (displayNameFilter) will be included in the request.

The second time and on, both filters will be included in a request. How can I work around that issue?


var nameFilter = grid.filters.getFilter('name');

if (!nameFilter) {
nameFilter = grid.filters
.addFilter({
type : 'string',
dataIndex : 'name'
});
}
nameFilter.setValue(Ext.getCmp('name-filter').getValue());

var displayNameFilter = grid.filters.getFilter('displayName');

if (!displayNameFilter) {
displayNameFilter = grid.filters
.addFilter({
type : 'string',
dataIndex : 'displayName'
});
}

displayNameFilter.setValue(Ext.getCmp('display-name-filter').getValue());

displayNameFilter.setActive(true, false);
nameFilter.setActive(true, false);