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

edit the contextmenu item

Thread ID:





124775 Jun 29,2016 10:16 AM UTC Jul 5,2016 05:49 AM UTC JavaScript 3
Tags: ejSpreadSheet
Asked On June 29, 2016 10:16 AM UTC

when i user the ejSpreadsheet,i want to change the items of contextmenu when i select a row and right click. how to solve it? thank you!

Silambarasan I [Syncfusion]
Replied On June 30, 2016 09:20 AM UTC

Hi Xycool, 
Thank you for your interest in Syncfusion products. 
Your requirement “To change the items of Row header context menu in Spreadsheet” can be achieved by using ‘dataSource’ (ejMenu) property in ‘beforeOpen’ client-side event.  We have prepared a sample to demonstrate this and the same can be downloaded from the following link.  Please refer the below code example. 
$(function () { 
        beforeOpen: "beforeCMenuOpen" 
function beforeCMenuOpen(args) { 
    var cMenuObj, newDataSource; 
    if ($(args.target).hasClass("e-rowheader")) { 
        cMenuObj = $("#" + this._id + "_contextMenuRowHeader").data("ejMenu"); 
              //Here we can get the default dataSource of context menu 
              //var defaultDataSource = cMenuObj.model.fields.dataSource 
        //Change menu options 
        newDataSource = [ 
        if (JSON.stringify(cMenuObj.model.fields.dataSource) !== JSON.stringify(newDataSource)) { 
            cMenuObj.setModel({ fields: { dataSource: newDataSource } }); 
    args.cancel = true; //Prevent default process here 
Sample Link: 
Silambarasan I 

Replied On July 5, 2016 03:42 AM UTC

Thank you ,I use your solution to my problem,but i make a suggestion,you give me the  sample,i find a mistake.

  else if ($(args.target).hasClass("e-rowcell")) {
                var contentCMenu = $("#" + this._id + "_contextMenuRowHeader").data("ejMenu");

"_contextMenuRowHeader" should be "_contextMenuCell".

Anyway, thank you for your answer

Silambarasan I [Syncfusion]
Replied On July 5, 2016 05:49 AM UTC

Hi Xycool, 
We deeply regret for the inconvenience caused.  
We have accepted your suggestion and you can use “this._id + ‘_contextMenuCell’” to get the sheet content ejMenu object.  
Silambarasan I 


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