Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单击headerCheckbox时,不会为网格行调用checkcolumn事件(Extjs 6.6)_Javascript_Extjs_Extjs5_Extjs6 Classic - Fatal编程技术网

Javascript 单击headerCheckbox时,不会为网格行调用checkcolumn事件(Extjs 6.6)

Javascript 单击headerCheckbox时,不会为网格行调用checkcolumn事件(Extjs 6.6),javascript,extjs,extjs5,extjs6-classic,Javascript,Extjs,Extjs5,Extjs6 Classic,我在一个网格中添加了headerCheckbox,以获得选择/取消选择全部的功能。还将checkchange事件添加到checkcolumn。当我手动选择/取消选择任何复选框时,事件工作正常,但当我通过标题复选框进行选择时,它不会触发 因此,我的要求是每当复选框中有任何选择更改时,事件都应该被触发 这是我在网格中的列: { xtype: 'checkcolumn', dataIndex: 'xyz', text: '', headerCh

我在一个网格中添加了
headerCheckbox
,以获得选择/取消选择全部的功能。还将
checkchange
事件添加到
checkcolumn
。当我手动选择/取消选择任何复选框时,事件工作正常,但当我通过标题复选框进行选择时,它不会触发

因此,我的要求是每当复选框中有任何选择更改时,事件都应该被触发

这是我在网格中的列:

{     
      xtype: 'checkcolumn',
      dataIndex: 'xyz',
      text: '',
      headerCheckbox: true,
      width: 25,
      stopSelection: true,
      sortable: false,
      draggable: false,
      resizable: false,
      menuDisabled: true,
      hideable: false
}
控制器中的事件:

control: {
    'checkcolumn':{
        checkchange: 'onCheckChange'
    }
},

onCheckChange : function ( checkbox, rowIndex, checked, record, e, eOpts ) {
    console.log(record);
}

要捕获列标题检查更改事件,您需要侦听“”:


如果将侦听器添加到checkcolumn组件而不是控制器的控制配置中,问题是否仍然存在?@ground\u call Yes我首先仅将其添加到组件中,然后只是为了清理代码,我将其添加到控制器中。但是行为还是一样的。这里有一个工作示例:它对你有用吗?
var store = Ext.create('Ext.data.Store', {
    fields: ['name', 'email', 'phone', 'active'],
    data: [{
        name: 'Lisa',
        email: 'lisa@simpsons.com',
        phone: '555-111-1224',
        active: true
    }, {
        name: 'Bart',
        email: 'bart@simpsons.com',
        phone: '555-222-1234',
        active: true
    }, {
        name: 'Homer',
        email: 'homer@simpsons.com',
        phone: '555-222-1244',
        active: false
    }, {
        name: 'Marge',
        email: 'marge@simpsons.com',
        phone: '555-222-1254',
        active: true
    }]
});

Ext.create('Ext.grid.Panel', {
    title: 'Simpsons',
    height: 200,
    width: 400,
    renderTo: Ext.getBody(),
    store: store,
    columns: [{
        text: 'Name',
        dataIndex: 'name'
    }, {
        text: 'Email',
        dataIndex: 'email',
        flex: 1
    }, {
        text: 'Phone',
        dataIndex: 'phone'
    }, {
        xtype: 'checkcolumn',
        headerCheckbox: true,
        text: 'Active',
        dataIndex: 'active',
        listeners: {
            headercheckchange: function(checkColumn, checked) {
                console.log("Header Checkbox change event: ", checked);
            },
            checkchange: function(checkboxColumn, rowIndex, checked, record, e, eOpts ) {
                console.log("Grid body column checkbox change event: ", rowIndex, checked, record);
            }
        }
    }]
});