简体   繁体   中英

Ext JS 4.2: Checkbox model selection issue

I recently switched to 4.2.1 from 4.1.3. 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)

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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