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

Context Menu for several selected records

Thread ID:





127023 Oct 21,2016 10:23 AM UTC Oct 26,2016 05:27 AM UTC JavaScript 3
Tags: ejGrid
Carlos Rodríguez García
Asked On October 21, 2016 10:23 AM UTC


I understand the context menu is by default operating on the selectedRecord.

When I right click on a row, even if before I had selected several of them, only that records gets selected and the context menu appears.

Is there a way so that when I right click to open the context menu, my selection does not change to that single row and it keeps all previous rows selected? This way I would be able to apply context menu "actions" to several rows at a time.

Thank you in advance for your help.

Kind regards,

Madhu Sudhanan P [Syncfusion]
Replied On October 24, 2016 01:48 PM UTC

Hi Carlos, 

Currently the Grid will clear the selection when context menu is opened.  But we can achieve your requirement with the below code example. 

       var cached; //Local variable to store selected indexes 
            dataSource: window.gridData, 
            selectionType: 'multiple', 
            contextMenuSettings: { enableContextMenu: true }, 
            . . .  . .  
            contextOpen: function () { 
                if (cache) 
                    this.selectRows(cache); //Select after context menu open 
            rowSelecting: function (args) { 
                //Store the selected indexes which can be selected after context opened. 
                if (this.selectedRowsIndexes.length > 1) { 
                    cache = this.selectedRowsIndexes.slice(0); 
                else { 
                    cache = null; 

In the above code example we have stored the selected indexes in the rowSelecting event and re-selected them after context menu opened in the contextOpen event. 

Madhu Sudhanan P 

Carlos Rodríguez García
Replied On October 25, 2016 01:05 PM UTC

Thank you very much, this worked perfect.

Madhu Sudhanan P [Syncfusion]
Replied On October 26, 2016 05:27 AM UTC

We are happy that your requirement is achieved. 
Please get back to us if you require further assistance. 
Thanks & regards, 
Madhu Sudhanan P 


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