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
close icon

Remove extract delete, edit properties added automatically in context menu

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


3 Replies

RU Ragavee U S Syncfusion Team 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. 



JA Juan Acosta 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


RU Ragavee U S Syncfusion Team 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. 


Loader.
Live Chat Icon For mobile
Up arrow icon