简体   繁体   English

Ext JS 4.2:复选框模型选择问题

[英]Ext JS 4.2: Checkbox model selection issue

I recently switched to 4.2.1 from 4.1.3. 我最近从4.1.3切换到4.2.1。 I have a grid with check box model. 我有一个带有复选框模型的网格。 When user select or deselect a record, app selects (or deselects) all relevant records based common record attribute value. 当用户选择或取消选择一条记录时,应用会根据通用记录属性值选择(或取消选择)所有相关记录。 This was working perfectly,but, after migration, stop works. 这个工作正常,但是在迁移后停止工作。 When I looked at on FB, I can see two events fired (select and deselect) 在FB上查看时,可以看到触发了两个事件(选择和取消选择)

var exSelectionModel = Ext.create('Ext.selection.CheckboxModel', {
checkOnly: false,

viewConfig: {
    listeners: {
        beforecellmousedown: function(view, cell, cellIdx, record, row, rowIdx, eOpts){

        }
    }
},
listeners: {

    selectionchange: function(sm, selections) {

        console.log(selections);
    },


    select: function( sm, record, index, eOpts ){               

        var blockId = record.data.blockId;          

        var blockRecords = sm.getStore().queryBy(function(rec){
            return rec.data.blockId == blockId;


        var records = new Array();  
        Ext.each(blockRecords.items, function(bRec){                
            records.push(bRec);
        });

        sm.select(records,true,true);


    },
    deselect: function( sm, record, index, eOpts ){
        var blockId = record.data.blockId;


        var blockRecords = sm.getStore().queryBy(function(rec){
            return rec.data.blockId == blockId;
        });

        var records = new Array();  
        Ext.each(blockRecords.items, function(bRec){  
            records.push(bRec);
        });

        sm.deselect(records,true,true);
    }
}

}); });

Did anything change in Ext JS 4.2.1 from 4.1.3 从4.1.3起在Ext JS 4.2.1中做了什么更改

Looks like I found an answer. 看起来我找到了答案。 I added following attributes 我添加了以下属性

    checkOnly: true,
    allowDeselect: false,
    ignoreRightMouseSelection: true,

Something changed or is somewhere broken in 4.2.1 4.2.1中发生了更改或损坏的地方

我在ExtJS 4.2中使用Checkbox selModel时遇到的问题是,我也使用了分组功能,看起来好像有冲突

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

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