We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Right click is selecting rows when Context Menu Items is used

Thread ID:

Created:

Updated:

Platform:

Replies:

143215 Mar 9,2019 02:34 PM UTC Mar 13,2019 04:03 AM UTC JavaScript - EJ 2 5
loading
Tags: Grid
Davi Daniel Siepmann
Asked On March 9, 2019 02:34 PM UTC

We've set some items for the context menu, but since then, the right click (to open the context menu) is actually selecting the rows and that's not an expected behavior.
For example if I right-click three lines, the three lines are remaining selected.

Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 11, 2019 11:23 AM UTC

Hi Davi, 

Greetings from Syncfusion. 

By default, we have select the rows when we do right click on the row. Because we have shown the default features (Editing, Deleting, Export) of Grid in those context menu. But you need not to select the rows when we do right click on those rows. So, we need some more clarification on your requirement and please provide the following details for better assistance. 

  1. Share an exact requirement on not to select the rows while we click for context menu in Grid.
  2. If you face any issue while do right click with selecting those rows ?
  3. Share a pictorial representation of your requirement.
  4. Share some more details on your requirement with context menu in Grid ?

Regards, 
Thavasianand S. 


Davi Daniel Siepmann
Replied On March 11, 2019 12:47 PM UTC

Good morning you all, thanks for the prompt return.

Share an exact requirement on not to select the rows while we click for context menu in Grid.
Well, let's say you've selected 3 rows to do a bulk action, and then you realize you want to use the "Context Menu" option to do something else. Then in this case, you'll end up with four rows selected instead of the first 3 ones. If you do the bulk action without realizing the Widget actually selected one more for you, you'll end up messing up your stuff.

If you face any issue while do right click with selecting those rows ?
The widget "goes crazy" when you use right click and then you decide clicking over the other rows, even with the "checkboxOnly" set to true. It selects another row, not the one you clicked (and remember, "checkboxOnly" is set to true, so it shouldn't even select any row)

Share a pictorial representation of your requirement
I think the first two answers represents a pictorial action, but the next answer can make it even clearer ;)

Share some more details on your requirement with context menu in Grid ?
We have more then one view for the display of our items, so we've decided to create a dialog for the edition of the records, a dialog we can call from anywhere. So we use the context menu to open this edition dialog. In case the user opens the dialog and decides just to close it, and lets say it does it three items, it'd remain with three "undesired" selected rows, instead of, well, none, as he dit not select anything.

Hope it's clearer. Thank you guys.

Pavithra Subramaniyam [Syncfusion]
Replied On March 12, 2019 06:27 AM UTC

Hi Davi, 
 
We have analyzed your requirement. To cancel selecting the row during context-menu open we suggest you to bind the “mousedown” event to Grid. And based on the clicked mouse button, we will be cancelling the selection in the “rowSelecting” event of Grid. Please refer the code example below, 
 
    var flag = false; 
    var grid = new ej.grids.Grid({ 
        ... 
        rowSelecting:function(args){ 
            if(flag == true){ 
              args.cancel = true;     //cancel the selection during opening context menu by right click 
              flag = false; 
            } 
        }, 
        ... 
    }); 
    grid.appendTo('#Grid'); 
 
    document.getElementById("Grid").addEventListener('mousedown',function(args){ 
      if(args.which == 3){         //check for the right click mouse button 
        flag = true; 
      } 
    }) 
 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra S. 


Davi Daniel Siepmann
Replied On March 12, 2019 03:00 PM UTC

The proposed solution did the job.

Thank you for your prompt support!

Thavasianand Sankaranarayanan [Syncfusion]
Replied On March 13, 2019 04:03 AM UTC

Hi Davi, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
                          
Regards, 
Thavasianand S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;