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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Remove extract delete, edit properties added automatically in context menu

Thread ID:

Created:

Updated:

Platform:

Replies:

127463 Nov 17,2016 04:47 AM UTC Dec 8,2016 05:29 AM UTC ASP.NET MVC 3
loading
Tags: Grid
Juan Acosta
Asked On November 17, 2016 04:47 AM UTC

Hi,

I have a normal grid and I have it overloaded to allows edit and delete.

.EditSettings(edit =>
{
edit.AllowDeleting().AllowEditing().EditMode(EditMode.DialogTemplate).TitleColumn("Name").DialogEditorTemplateID("#templateMaintenance");
})
I notice that the grid automatically add the edit and delete option in the context menu.



I really don't want those options to be shown there because I have another delete option overloaded. I only need the options that appear in the toolbar.

 .ToolbarSettings(toolbar =>
                 {
                     toolbar.ShowToolbar().ToolbarItems(items =>
                     {
                         items.AddTool(ToolBarItems.Edit);
                         items.AddTool(ToolBarItems.Delete);
                         items.AddTool(ToolBarItems.Update);
                         items.AddTool(ToolBarItems.Cancel);
                         items.AddTool(ToolBarItems.PrintGrid);
                         items.AddTool(ToolBarItems.ExcelExport);
                         items.AddTool(ToolBarItems.WordExport);
                         items.AddTool(ToolBarItems.PdfExport);
                     });
                 })

Also, If I leave those options and begin to test it I have some issues with the delete and edit in the context menu.
It works erratically. Sometimes even If I select 3, only remove one or even worst the next iteration broke the nodetype of the grid.
The edit option also does not charge anything in the args.data.



Please check this error.




Uncaught TypeError: Cannot read property 'nodeType' of undefined(…)
attr @ jquery.js:6956
n.access @ jquery.js:3500
attr @ jquery.js:6943
selectRows @ ej.web.all.min.js:10
contextOpenMaintenance @ Default:1232
_trigger @ ej.web.all.min.js:10
_menu @ ej.web.all.min.js:10
f @ jquery.js:512
_trigger @ ej.web.all.min.js:10
showContextMenu @ ej.web.all.min.js:10
_ContextMenuHandler @ ej.web.all.min.js:10
dispatch @ jquery.js:4430
r.handle @ jquery.js:4116

Could you please help disabling that extra context menu options.

Kind regards,

Juan


Ragavee U S [Syncfusion]
Replied On November 18, 2016 09:38 AM UTC

Hi Juan, 

Thanks for contacting Syncfusion support. 

We can disable the default context menu items by setting the DisableDefaultItems property of the Grid ContextMenuSettings as true. Please refer to the below api documentation for more information. 


Else, if you would like to disable only certain context menu items but not all the default items, then we suggest you to specify only the required actions/items within the contextMenuItems property of the Grid ContextMenuSettings. 




Regards, 
Ragavee U S. 


Juan Acosta
Replied On December 6, 2016 04:50 AM UTC

Hi Ragavee,

Thanks for your help.
I used the property

contextMenu.EnableContextMenu().DisableDefaultItems(true)

And it works perfectly.

Kind regards,

Juan

Ragavee U S [Syncfusion]
Replied On December 8, 2016 05:29 AM UTC

Hi Juan, 
  
Thanks for your update. 
 
We are happy that your requirement is achieved 
  
Regards, 
Ragavee U S. 


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

;