diff --git a/cmp/grid/Grid.js b/cmp/grid/Grid.js index 95f9e03421..c07c98830b 100644 --- a/cmp/grid/Grid.js +++ b/cmp/grid/Grid.js @@ -145,9 +145,8 @@ export class Grid extends Component { } render() { - const {model, props, agOptions} = this, - {treeMode, agGridModel} = model, - {onKeyDown} = props; + const {model, agOptions, onKeyDown} = this, + {treeMode, agGridModel} = model; // Note that we intentionally do *not* render the agGridReact element below with either the data // or the columns. These two bits are the most volatile in our GridModel, and this causes @@ -597,6 +596,15 @@ export class Grid extends Component { return column.isTreeColumn ? node.data[column.field] : value; } + onKeyDown = (evt) => { + const {selModel} = this.model; + if ((evt.ctrlKey || evt.metaKey) && evt.key == 'a' && selModel.mode === 'multiple') { + selModel.selectAll(); + return; + } + + if (this.props.onKeyDown) this.props.onKeyDown(evt); + } } export const grid = elemFactory(Grid); \ No newline at end of file diff --git a/data/StoreSelectionModel.js b/data/StoreSelectionModel.js index 5ba4a0ce49..771f87db2a 100644 --- a/data/StoreSelectionModel.js +++ b/data/StoreSelectionModel.js @@ -84,6 +84,15 @@ export class StoreSelectionModel { this.ids = clearSelection ? ids : union(this.ids, ids); } + /** Select all filtered records. */ + @action + selectAll() { + if (this.mode === 'multiple') { + this.select(this.store.records); + } + } + + /** Clear the selection. */ @action clear() {