How to disable selection when mouse right click

I only need row to be selected when mouse left click. But now it has been selected when mouse double left click and right click. How to disable that? Thanks. 


5 Replies

AP Abinesh Palanisamy Syncfusion Team July 23, 2024 07:24 AM UTC

Hi Marno,

Based on the details provided, SfDataGrid does not support selection using the right mouse button. All selections are achieved using only the left mouse button on a tap. To assist you further and understand the issue better, we kindly request that you provide any additional details or steps that might help us reproduce the problem. Additionally, please replicate the issue in a simple sample, and include device details if possible. This will greatly assist us in investigating the issue further and providing an appropriate solution as quickly as possible.


Regards,

Abinesh P



MA Marno replied to Abinesh Palanisamy August 1, 2024 09:36 AM UTC

Thank you for your reply. I found that if I use onCellDoubleTap it will cause this bug.

Snipaste_2024-08-01_17-29-35 (1).png



MA Marno replied to Abinesh Palanisamy August 1, 2024 09:43 AM UTC

I also tried the official demo on GitHub, and after I set the onCellDoubleTap property, the right-click also select item.


Snipaste_2024-08-01_17-39-50 (1) (1) (1).png



AP Abinesh Palanisamy Syncfusion Team August 2, 2024 06:43 AM UTC

Hi Marno,

We have checked your query at our end, and we are able to replicate that issue at our end. We have considered this as a  bug and logged a bug report regarding this in our feedback portal. We will fix the reported issue and include the changes in our upcoming weekly patch release, which is expected to be rolled out on August 13, 2022. We will let you know once released, and we appreciate your patience until then. You can also track the status of the bug using the feedback link below.


Feedback Link: 60075


Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization. 


Regards,

Abinesh P



AP Abinesh Palanisamy Syncfusion Team August 13, 2024 10:24 AM UTC

Hi Marno,


Query

Response

Right Click selection

We are glad to inform you that the reported problem has been resolved on our end. Therefore, kindly update SfDataGrid to the latest version(26.2.9).

 

Root cause : We are handling both the TapDown and secondary tap events with a single method to perform editing and other selection behaviors. We have a condition that allows selection when the onCellDoubleTap callback is enabled. However, this condition is improperly allowing selection with a right-click when the onCellDoubleTap callback is enabled, leading to the issue.

 

If you have any further queries, please don't hesitate to reach out. We are more than happy to assist you.

 

Regards,

Abinesh P

Double left click selection

In SfDataGrid, row selection is based on a left-click. We have a workaround to restrict selection on double left-click by using the onSelectionChanging and onCellDoubleTap callbacks. The onCellDoubleTap callback is triggered before onSelectionChanging, so you can detect a double tap on a specific row using a flag variable. To prevent row selection on a double left-click, simply return false in the onSelectionChanging callback. We have included sample. Please consult the samples for further information and adapt them as per your requirements.



Regards,

Abinesh P


Attachment: SfDataGrid_4bb0f637.zip

Loader.
Up arrow icon