PDA

View Full Version : checkbox in filter not clearing after clearing grid filters



shankar8rajah1
28 Oct 2013, 9:26 AM
Hi,

I have the following code to clear filters:


var grid = Ext.create('Ext.ux.LiveFilterGridPanel', { border: false,
region: 'center',
indexes:['name','service_group','azul_version', 'host_tech','ait_num','app_name','data_center','filer_mounts','instnaces','env'],
store: store,
columns: createHeaders(10),
loadMask: true,
features: [filters],
width: 400,
layout: 'fit',
bbar: Ext.create('Ext.Toolbar')
});


// add some buttons to bottom toolbar just for demonstration purposes
grid.child('[dock=bottom]').add([
'->',
{
text: 'Clear Filter Data',
handler: function () {
grid.filters.clearFilters();
}
}
]);

When I click the Clear Filter Data, the filter on the data is disappears as it should, but the options that was selected for a particular column is still checked. Do I have to do something else to get rid of the checked checkboxes?

scottmartin
30 Oct 2013, 5:25 AM
You should be able to clear the store filters. I see you are using a UX?

You can also clear the filters yourself but overriding the menu



Ext.override(Ext.ux.grid.FiltersFeature,{

onMenuBeforeShow: function(menu) {
var me = this,
menuItem, filter;

if (me.showMenu) {
menuItem = me.menuItem;
if (!menuItem || menuItem.isDestroyed) {
me.createMenuItem(menu);
menuItem = me.menuItem;
}

filter = me.getMenuFilter();

if (filter) {
menuItem.setMenu(filter.menu, false);
menuItem.setChecked(filter.active);

if (filter.active === false) { // or menuItem.checked
for (var i = 0; i < filter.menu.items.length; i++) {
if (filter.menu.items.items[i].checked !== undefined) { // only checkboxes
filter.menu.items.items[i].setChecked(false);
} else {
if (filter.menu.items.items[i].value !== undefined) { // only editors, not |
filter.menu.items.items[i].setValue('');
}
}
}
}

// disable the menu if filter.disabled explicitly set to true
menuItem.setDisabled(filter.disabled === true);
}
menuItem.setVisible(!!filter);
this.sep.setVisible(!!filter);
}
},
});

shankar8rajah1
1 Nov 2013, 5:18 AM
Thanks, this worked great!