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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Context Menu and Row Selection

Thread ID:

Created:

Updated:

Platform:

Replies:

143449 Mar 20,2019 02:58 PM UTC Mar 21,2019 04:52 AM UTC Angular - EJ 2 1
loading
Tags: Grid
Samir Modi
Asked On March 20, 2019 02:58 PM UTC

Hi Team,

I have a situation while working with grid and rows having contex menu. The problem is, context menu triggers row selection by default and i have an api call on row selection event which pulls remote data. and displays in another grid underneath. Is there a way i can disable row selection on context menu. Currently, every time i right click it tries to fetch data for that row. Thanks in advance!

Regards,
Samir

Pavithra Subramaniyam [Syncfusion]
Replied On March 21, 2019 04:52 AM UTC

Hi Samir, 

Greetings from Sycnfusion. 

You can cancel selecting the row during context-menu open by binding the “mousedown” event to Grid using the “created” event of 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, 

    <ejs-grid #Grid [dataSource]='data' ... (rowSelecting)="rowSelecting($event)" (created)="created($event)"> 
        ... 
    </ejs-grid> 

[ts] 

    created(args){ 
        this.grid.element.addEventListener('mousedown',function(args){ 
          if(args.which == 3){         //check for the right click mouse button 
            this.flag = true; 
         
        }.bind(this)) 
   
    rowSelecting(args){ 
      if(this.flag == true){ 
        args.cancel = true;     //cancel the selection during opening context menu by right click 
        this.flag = false; 
     
   



 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra 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

Live Chat Icon For mobile
Live Chat Icon