primereact icon indicating copy to clipboard operation
primereact copied to clipboard

DataTable onRowClick executes when multiple selection mode is enabled and user clicks on selection checkbox column cell

Open austinbruch-sas opened this issue 6 years ago • 1 comments

There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[X] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports) Please fork the codesandbox below and create a case demonstrating your bug report. Issues without a codesandbox have much less possibility to be reviewed.

https://codesandbox.io/s/blissful-morse-dstwt?file=/src/demo/DataTableSelectionDemo.js

Current behavior

When using the DataTable component with a onRowClick prop supplied, in conjunction with multiple selection mode via checkbox, clicking on the selection column triggers the onRowClick callback, which can cause problems if the action is extreme enough (navigation, etc.) The onRowClick should not be called when clicking on the selection column.

Expected behavior

As described above, the onRowClick should not be called when clicking on the selection checkbox cell of a given row, when multiple selection is enabled.

This block attempts to fix the issue, but does not solve the case of the built-in multiple selection column via checkbox.

This is similar to #886, which didn't receive proper resolution, in my opinion.

Minimal reproduction of the problem with instructions

See the sample codesandbox link provided above.

Please tell us about your environment:

OS: macOS package manager: npm server: webpack dev server

  • React version:

16.13.1

  • PrimeReact version:

4.2.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Only tried Chrome 81.*

  • Language: [all | TypeScript X.X | ES6/7 | ES5] Only tried ES6/5

austinbruch-sas avatar Aug 27 '20 17:08 austinbruch-sas

Thanks for the fix, @mertsincan. Are there any plans for this to be incorporated in a patch release of 4.x, or will it only be included in 5.x?

austinbruch-sas avatar Sep 10 '20 13:09 austinbruch-sas