gregnb / gregnb/mui-datatables

onRowSelect disrupted by dispatch or setState event

Open
#884 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

When I try to dispatch a redux event (or simply setState) within the onRowsSelect callback my events get dispatched but the box that was supposed to be selected never actually selects. If I take the dispatch or setState method out the box updates as expected.

## Expected Behavior
I expect my redux store to be updated and for the checkbox to be selected.

## Current Behavior
My redux store does get updated but the checkbox for the datatables component does not get checked

## Steps to Reproduce (for bugs)
Here is my option variable:

(all inside the render method)
```
let {dispatch,callOrders} = this.props;
const options = {
filter: false,
print: false,
download: false,
responsive: 'scroll',
onRowsSelect: (currentRowsSelected, allRowsSelected) => {
let selectedItems = allRowsSelected.map(item => {
return callOrders.callOrders[item.index];
})
dispatch(setSelectedCallOrders({selectedCallOrders: selectedItems}))
}
}
```

## Your Environment
I'm experiencing this issue within a create-react app env

| Tech | Version |
|--------------|---------|
| Material-UI | ^4.3.3 |
| MUI-datatables | ^2.9.0 |
| React | ^16.9.0 |

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.