source: [view]
this.selection = selection;
var grid = this.grid = selection.grid;
grid.onSelectedById = this.onSelectedById;
this.reset();
var oldClearData = grid._clearData;
var _this = this;
grid._clearData = function(){
_this._updateMapping(!grid._noInternalMapping);
_this._trustSelection = [];
oldClearData.apply(grid, arguments);
};
this.connect(grid, '_setStore', 'reset');
this.connect(grid, '_addItem', '_reSelectById');
this.connect(selection, 'addToSelection', dojo.hitch(this, '_selectById', true));
this.connect(selection, 'deselect', dojo.hitch(this, '_selectById', false));
this.connect(selection, 'selectRange', dojo.hitch(this, '_updateMapping', true, true, false));
this.connect(selection, 'deselectRange', dojo.hitch(this, '_updateMapping', true, false, false));
this.connect(selection, 'deselectAll', dojo.hitch(this, '_updateMapping', true, false, true));