简体   繁体   English

在Ext Js网格过滤器中取消选中过滤器菜单的复选框时触发事件?

[英]Trigger an event when filter menu's checkbox is unchecked in Ext Js grid filters?

I have been using gridfilters plugin for my table to be displayed. 我一直在使用gridfilters插件来显示我的表格。 At the moment I am applying a custom remote filter whenever the column menu's filter is changed, triggered by a "filterchange" event. 目前,每当列菜单的过滤器发生更改时,我都会应用自定义远程过滤器,由“filterchange”事件触发。 On the main ViewPort: 在主ViewPort上:

xtype: 'gridpanel',
        title: 'Autopilot Monitor',
        titleAlign: 'center',
        store: 'AutopilotQueueStore',
        id: 'grid',
        plugins: 'gridfilters',
        maxRows: 20,
        selModel: {
            selType: 'cellmodel',
            mode: 'SINGLE'
        },
        listeners: {
            filterchange: 'onFilterChange'
        },

Whenever I fill the filter's menu fields, the filterchange event is called and the filter is applied. 每当我填充过滤器的菜单字段时,都会调用filterchange事件并应用过滤器。 At the same time, when the field is filled, the menu checkbox for the filter is checked. 同时,填充字段时,将检查过滤器的菜单复选框。 Although, no event is called (not even filterchange) when I uncheck the filter menu checkbox. 虽然,当我取消选中过滤器菜单复选框时,不会调用任何事件(甚至不会过滤更改)。

I need to catch an event to be called whenever the checkbox's status is changed (checked or unchecked). 每当复选框的状态发生变化(选中或取消选中)时,我都需要捕获要调用的事件。 How can I manage to do it? 我怎么能设法做到这一点? My controller: 我的控制器:

onFilterChange: function (store, filters, e) {
    console.log(checkbox);
    var store = Ext.getStore('AutopilotQueueStore');
    var cmp = Ext.getCmp('id');
    Ext.override(Ext.grid.filters.Filters, { filterCls: Ext.baseCSSPrefix });
    store.clearFilter();
    var filter = filters[0];
    var txt = ""
    Ext.getCmp('filterTextField').setValue("");
    if (filter != undefined) {
        store.getProxy().extraParams = {
            filterColumn: filter.getValue() + "," + filter.getProperty(),
            filter: ''
        }
    }
    else {
        store.getProxy().extraParams = {
            filterColumn: txt,
            filter: ''
        }
    }

您可以使用其他侦听器获取此事件,您可以在用户激活(或选中复选框)过滤器时使用filteractivate触发,并在用户取消激活(或取消选中复选框)过滤器时使用filterdeactivate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM