primereact icon indicating copy to clipboard operation
primereact copied to clipboard

DataTable: Cell Selection is Blocked - when having both cellSelection prop and a Column for row selection

Open dani-ras opened this issue 3 years ago • 1 comments

Describe the bug

I need to enable both cell selection and rows selection, but when having a Column for rows selection it blocks the cell selection from happening. tried to search for similar issues and didnt find.

Reproducer

https://codesandbox.io/s/primereact-test-forked-gq6tjq?file=/src/DataTableTest.tsx

PrimeReact version

8.3.0

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

go to given sandbox fork, at DataTableTest.tsx line 217, comment out the selection Column for enabling row selection and blocking cell selection.

Expected behavior

enable rows selection and keep cell selection available and enabled too.

dani-ras avatar Aug 18 '22 06:08 dani-ras

ended up with a workaround, adding a custom checkbox column, and using the p-highlight on rowClassName for the same style effect

perhaps someone could benefit from sharing: https://codesandbox.io/s/primereact-test-forked-k970p1?file=/src/DataTableTest.tsx

dani-ras avatar Sep 01 '22 05:09 dani-ras