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.
Unfortunately, activation email could not send to your email. Please try again.

ejGrid with custom context menu item: How to get the target row (i.e. primary key) in contextClick event handler function?

Thread ID:





131206 Jun 28,2017 03:26 AM Jun 30,2017 03:31 AM Angular 3
Tags: ejGrid
Thomas Wittwer
Asked On June 28, 2017 03:26 AM

Setup: ejGrid with custom context menu item

How to get the target row (i.e. primary key) in contextClick event handler function?

Please advise.

Jayaprakash Kamaraj [Syncfusion]
Replied On June 29, 2017 11:19 AM

Hi Thomas, 

Thank you for contacting Syncfusion support. 

We have achieved your requirement using contextOpen and contextClick event of ejGrid. In contextOpen event, we need to store current target row data in global variable and then we can get the primaryKey value in contextClick event using that gloabal variable. Please refer to the below help document and code example. 

<ej-grid id="Grid" [dataSource]="gridData" [editSettings]="editSettings" (contextOpen)="contextopen($event)" allowSorting="true" (contextClick)="contextclick($event)" [contextMenuSettings]="contextSettings" [toolbarSettings]="toolbarSettings"> 
        <e-column field="EmployeeID" [isPrimaryKey]="true"></e-column> 
        <e-column field="FirstName" [editType]= "editType" [dataSource]="data1" ></e-column> 
        <e-column field="LastName" [allowEditing]="false"></e-column> 
export class GridComponent { 
    public gridData: any; 
       public data1 : any; 
    public pagesize: number; 
       public targetRowData : any; 
    this.targetRowData = e.model.currentViewData[e.rowIndex]         


Jayaprakash K. 

Thomas Wittwer
Replied On June 29, 2017 02:47 PM

Thank you for your support.



Jayaprakash Kamaraj [Syncfusion]
Replied On June 30, 2017 03:31 AM

Hi Thomas,  
Thanks for the update. 
Please get back to us if you need any further assistance.   
Jayaprakash K. 


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.

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.