简体   繁体   中英

How to add shift+click functionality to checkboxmodel for grid in extjs?

today I am facing a problem with shift+click functionality problem in extjs 4 .I want to do same functionality as it is in gmail . On clicking checkbox with shift+click row should get selected.I have grid panel with checkbox - selModel . And I want to add this functionality on clicking on checkbox only not on cellclick. I have checked mode and multiSelect config from checkboxModel and grid panel , but they are working for row selection only not on checkbox selection.Thanks in advance.

Finally, Working solution with ext js 4.2

Ext.define('MyApp.override.CheckboxModelOverrides', {
override: 'Ext.selection.CheckboxModel', 

 onRowMouseDown : function(view, record, item, index, e) {
    var me = this;

    if (index !== -1) {

        if (!me.allowRightMouseSelection(e)) {
            return;
        }

        if (e.shiftKey && me.lastFocused) {
            me.selectRange(me.lastFocused, record, e.ctrlKey);
            me.processSelection(view, record, item, index, e);
        }

        if (!me.isSelected(record)) {
            me.mousedownAction = true;
            me.processSelection(view, record, item, index, e);
        } else {
            me.mousedownAction = false;
        }
    }

  }   
});

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