UNPKG

915 BMarkdownView Raw
1## Actions
2
3Each of the reducers: grid, pager, selection, etc have supporting actions. You may wish to dispatch these actions from other areas of your application outside of the grid. For instance, you could select all/deselect all rows in a grid from another component in your application.
4
5
6## Selection Actions
7
8Add the actions
9
10```
11import { Actions } from 'react-redux-grid';
12```
13
14Map them to this.props
15
16```
17const mapDispatchToProps = (dispatch) => {
18 return {
19 deselectAll: stateKey => {
20 dispatch(Actions.SelectionActions.deselectAll(stateKey))
21 },
22 }
23}
24```
25
26Use them in your components from this.props
27
28```
29 // get the all selection row ids
30 const gridMap = this.props.selection.get("myGridStateKey");
31 const selectedIds = gridMap.get("indexes");
32
33 // call a bulk selection action to deselect all the rows
34 const stateKey = "myGridStateKey";
35 this.props.deselectAll(stateKey);
36
37```
\No newline at end of file