Ext.grid.livegrid.CheckboxSelectionModel mouse and keyboard events called twice
How to Reproduce:
Load the Checkbox demo in the livegrid source and either click on a row or try moving up and down rows with the arrow keys. Moving up and down results in skipping a record each time and clicking with the mouse only allows certain actions to take place because mousedown and keyup are being called twice each time.
Problem:
Red text represents the problem and green text represents the added code to solve it.
Line 68 of Ext.grid.livegrid.CheckboxSelectionModel.js
Code:
initEvents : function()
{
this.skipParentInitEvents = true;
Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.initEvents.call(this);
this.grid.view.on('reset', function(gridView, forceReload) {
this.headerCheckbox = new Ext.Element(
gridView.getHeaderCell(this.grid.getColumnModel().getIndexById(this.id)).firstChild
);
if (this.markAll && forceReload === false) {
this.headerCheckbox.addClass('x-grid3-hd-checker-on');
}
}, this);
Ext.grid.CheckboxSelectionModel.prototype.initEvents.call(this);
},
and line 64 of Ext.grid.livegrid.RowSelectionModel.js
Code:
initEvents : function()
{
if(!this.skipParentInitEvents){
Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);
}
var grid = this.grid,
view = grid.view,
store = grid.store;
view.on('rowsinserted', this.onAdd, this);
store.on('selectionsload', this.onSelectionsLoad, this);
store.on('load', this.onStoreLoad, this);
},
Because of these three superclass calls the Ext.ux.grid.livegrid.RowSelectionModel.superclass gets called twice resulting in Ext.grid.RowSelectionModel.initEvents being called twice and the mousedown and keyup events being doubled.
Solution:
By adding a flag for skipping the superclass initEvents, the CheckboxSelectionModel can still call both superclasses without worry of the double event hooks.