Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in DataTable's Tablebody onRowMouseDown event implies that all rows are draggable #7332

Closed
feg3jvl opened this issue Oct 11, 2024 · 3 comments
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@feg3jvl
Copy link

feg3jvl commented Oct 11, 2024

We are having a specific problem in the TableBody implementation that implies that all the rows in the table are draggable, and that the draggable attribute is not being read and resolving the situation. In my implementation, the attribute dragSelection is false.
We tried to passtrought in all the layers (table, tablebody, columns, etc) the attribute draggable as false, but without success.

In the DataTable documentation itself, all the tables without exception have the same behaviour (I wasn't able to attach a file here). The scenario is simply try to copy the content of a cell in the DataTable. (https://primereact.org/datatable/)

In my investigation of the issues, looks like that the commit above is causing the issue. The isDraggableHandle within onRowMouseDown is what appears to be the root cause of the problem, as it only considers the p-datatable-reorderablerow-handle class. https://github.com/primefaces/primereact/blame/fb0305717f1ff05bf9a521b70208087fdd8d7995/components/lib/datatable/TableBody.js#L595

As a workaround that I found to resolve the issue, in case you don't need the onRowMouseDown event, is to capture the event and stop the propagation:

  <PrimeDataTable onMouseDownCapture={(e) => { e.stopPropagation(); }}>
...

But this is not the ideal way to fix it. If you guys have a better alternative, I would be glad to see.
But I think this should be resolved, because the draggable attribute is missleading in this case. The main attribute to use that drag and drop should be at the table level the dragSelection and via props the draggable.

@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 11, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 11, 2024
@melloware
Copy link
Member

Related to: #7321

@melloware
Copy link
Member

Can you try 10.8.5 please?

@melloware melloware added this to the 10.8.5 milestone Dec 30, 2024
@melloware
Copy link
Member

I will re-open if its still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants