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

Show/Hide context menu items

According to the examples, to hide context menu items you need to provide the display text of that item:

Since context menu items can be defined with an ID:

Is there a way to hide items based on their ID instead? It would make managing the content ALOT easier when different languages are used.

3 Replies

GM Gopinath Munusamy Syncfusion Team October 13, 2022 05:25 AM


Greetings from Syncfusion support.

We have checked your query and we have prepared a sample to show and hide the expand and collapse items in context menu using their ID. In this sample, we have used contextMenuOpen event to hide the expand and collapse item from the list by passing the id value in the hideItems method. We have attached the sample and code snippets for your reference. Please check the below sample and code snippets for more details,

Code Snippets:


let contextMenuOpen: EmitType<ContextMenuOpenEventArgs> = (

  args?: ContextMenuOpenEventArgs

) => {

  let record: IGanttData = args.rowData;

  var menuObj = document.getElementById('ContextMenu_contextmenu').ej2_instances[0];

  if (args.type !== 'Header') {

    menuObj.hideItems(['expandrow', 'collapserow'], true);



Sample:  https://stackblitz.com/edit/rsh4k5-2xpj1l?file=index.ts


Gopinath M

JH JACQUES HACHE October 13, 2022 06:49 AM

Thanks alot that's great!

GM Gopinath Munusamy Syncfusion Team October 14, 2022 01:09 AM


You’re most welcome. Please get back to us if you require any further assistance.


Gopinath M

Live Chat Icon For mobile
Up arrow icon