The CellSelection mixin extends upon the functionality of the Selection mixin to provide selection at the cell level instead.
require([
'dojo/_base/declare',
'dgrid/OnDemandGrid',
'dgrid/CellSelection'
], function (declare, OnDemandGrid, CellSelection) {
var grid = new (declare([ OnDemandGrid, CellSelection ]))({
selectionMode: 'single',
// ...
});
});
- The
selection
object stores a nested hash, where the outer hash is keyed by item ID and the inner hashes are keyed by column ID. - The
dgrid-select
anddgrid-deselect
events still fire, but include acells
property containing an array of cell objects, rather than arows
property. - Whereas Selection's
select
,deselect
, andisSelected
methods look up the passed argument via List'srow
method, CellSelection looks it up via Grid'scell
method. - The
allowSelect
method is passed a cell object instead of a row object.