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:

Created:

Updated:

Platform:

Replies:

126350 Oct 10,2016 02:58 PM UTC Oct 12,2016 03:42 AM UTC JavaScript 3
loading
Tags: ejGrid
duncan
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?

Regards,

Duncan

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. 

 
$("#Grid").ejGrid({ 
                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. 

Regards, 
K.Karthick. 


duncan
Replied On October 11, 2016 02:07 PM UTC

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

Regards,

Duncan

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. 

Regards, 
K.Karthick. 


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.

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

;