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

customContextMenuItems - How do I get the ID of the row it was on

Thread ID:





126350 Oct 10,2016 02:58 PM UTC Oct 12,2016 03:42 AM UTC JavaScript 3
Tags: ejGrid
Asked On October 10, 2016 02:58 PM UTC

Your documentation is poor.

The first thing that I want to do when I click on my custom menu is to find out which row it was on and get the data from the row. Everybody will want to do something similar.

Please can someone explain how I might do this?



Karthick Kuppusamy [Syncfusion]
Replied On October 11, 2016 11:23 AM UTC

Hi Duncan, 

Thanks for Contacting Syncfusion support. 

We have analyzed your requirement and we can get the  selected row and its data through “context click” event of the ejGrid. 

Please find the code example. 

                dataSource: window.gridData, 
                allowPaging: true, 
                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, }, 
                toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit,            ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] }, 
                contextMenuSettings: { enableContextMenu: true, contextMenuItems: [], customContextMenuItems: ["Custom Context"] },//Custom Context menu 
                contextClick: function (args) { 
                    if (args.text == " Custom Context ") 
                    var rowid = this.selectedRowsIndexes[0];//get the row id 
                    var selectedrecordsdata = args.model.selectedRecords;//get the selected records data 
                columns: [ 

Please refer the following UG link for more information. 

For your reference we have created a JS playground sample. 

Please let us know if you have any concern. 


Replied On October 11, 2016 02:07 PM UTC

Thanks that's great! ;) Solved my issue & a few others elsewhere.



Karthick Kuppusamy [Syncfusion]
Replied On October 12, 2016 03:42 AM UTC

Hi Duncan, 

Thanks for the update. 

We are happy to hear that your requirement is achieved. 



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