search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to Hide Context Menu Item

Asked by Robert
1 year ago.

I have a scenario where I need to toggle an Event context menu item (Cancel / Activate) so that the context menu only shows the appropriate option for the event.

  • Active Events need to display the Cancel Item and Hide (not disable) the Activate Item
  • Cancelled Events need to display the Activate Item and Hide (not disable) the Cancel Item

I am looking for an action similar to below that will allow be to set the visibility of the item to false. I am unable to find anything in the documentation that describes this. (I am aware "show = false" is not a valid option). I would also rather not use multiple context menus as there are 7 other items in the menu.

if ( {[context.CancelShift].show = false;
} else {[context.ActivateShift].show = false;

Currently Using DayPilot Pro for JavaScript 2019.1.3572


Answer posted by Dan Letecky [DayPilot]
1 year ago.

You can do this in onShow event handler - it's called before the menu is displayed and you can use it to modify the context menu items.

You can find an example here:

Instead of "disabled" menu item property, use "hidden":

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.