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

JavaScript error when right-clicking on a cell in the scheduler control when there are no context menu items defined

Asked by Scott Mitchell
10 years ago.

I am using the DayPilotMenu control and the DayPilotScheduler in tandem in an ASP.NET MVC application. The DayPilotMenu control displays a context menu when the user clicks in one of the cells of the scheduler that is not yet scheduled.

The menu items displayed in the context menu depend on the role of the logged in user and for some roles there are no applicable menu items. If there are no menu items when a user right-clicks on an empty scheduler cell the following JavaScript error is raised:

Error: uncaught exception: No menu items defined.

I've worked around this by adding conditionals to the markup in the MVC view so that the context menu isn't rendered for users in the affected roles. However, my expectation is that no client-side error would occur if there weren't any menu items - instead, it just wouldn't show the menu.

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