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. Image for the cookie policy date

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

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?



3 Replies

KK Karthick Kuppusamy Syncfusion Team 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. 


DU duncan October 11, 2016 02:07 PM UTC

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



KK Karthick Kuppusamy Syncfusion Team October 12, 2016 03:42 AM UTC

Hi Duncan, 

Thanks for the update. 

We are happy to hear that your requirement is achieved. 


Live Chat Icon For mobile
Up arrow icon