Comcast / Comcast/react-data-grid

Updating selectedRows property on onRowClick event stops double click from working

Open
#2,540 9 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.7k
Forks
2.2k
Avg merge
1d 2h
Merged PRs (30d)
33

Description

I have a data grid setup like following:

``` html

```

I want to set selected rows on row click and not on checkbox click:
``` javascript
const [selectedRows, setSelectedRows] = useState>(() => new Set());
```

``` javascript
function rowClickHandler(row: any) {
let selectedRowsSet = new Set(selectedRows);
if (selectedRowsSet.has(row.id)) {
selectedRowsSet.delete(row.id);
} else {
selectedRowsSet.add(row.id);
}
setSelectedRows(selectedRowsSet);
}
```

But the above function disables functionality for double click to edit cell. I think it may be due to the state change that occurs when I call the `setSelectedRows` function to update selected row.

Is there any way in which I can click rows for selection and double click for cell edit to work ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.