gregnb / gregnb/mui-datatables
Error: number or rows selected on custom single selected row
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
First of all, great job on implemented this library. Since the table does not support single row select. I have to implemented some custom code to enforce the single select for the table. Below are the code that I implemented.
```
customToolbarSelect: (selectedRows) => {
const newSelectedRow = selectedRows.data.length > 1 ? selectedRows.data[1] : selectedRows.data[0];
const newSelectedIndex = parseInt(newSelectedRow.index);
const temp = {
data: newSelectedRow,
lookup: {}
};
temp.lookup[`${newSelectedIndex}`] = true;
if (selectedRows.data.length > 1) {
selectedRows.data = [];
selectedRows.lookup = temp.lookup;
selectedRows.data.push(temp.data);
}
}
},
....
```
## Expected Behavior
I expected that the number or `rows selected` on Toolbar would be either 0, or 1.
## Current Behavior
If I selected one row and then select another, the number of `rows selected` is 2, instead of 1. And unless I deselect the selected row to clear out the number. The number of `rows selected` stays at 2.
## Steps to Reproduce (for bugs)

## Your Environment
| Tech | Version |
|--------------|---------|
| Material-UI | 3.5.1 |
| MUI-datatables | 2.0.0-beta-41 |
| React | 16.6.0 |
| browser | Chrome |
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.