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

Context menu does not close on click inside scheduler, when 'timeRangeSelectedHandling' is set

Asked by Daniel L.
3 years ago.

Hey there =)

an unexpected behaviour occured while I was developing. Is the following a bug? Is there a way to fix it?

Problem description:
Via rightclick (+ also optional DayPilot.Areas), I can open a context menu which contains different settings.
When a setting is selected, the corresponding event fires, the context menu closes etc. This is wanted behaviour.
But when I open the context menu and decide that I want to close it right away (for example no setting fits my criteria), I can not close it by just clicking into empty space inside the scheduler. I have to click into empty spaces/on elements outside the scheduler on the website.

This only happens when the setting "timeRangeSelectedHandling" of the scheduler is set to "disabled".

Thanks in advance for any help!

Answer posted by Dan Letecky [DayPilot]
3 years ago.

Hi Daniel,

This should be fixed now in the latest sandbox build (2021.2.4981):
https://javascript.daypilot.org/sandbox/

Comment posted by Daniel L.
3 years ago.

Thanks a lot! :)

Comment posted by Tim K.
3 years ago.

Hi Dan,
the fix doesn`t work for us, because we`re showing the context menu manually with the show()-function and the onEventRightClick-Event. Is there a suitable event for hiding the context menu manually, by clicking in empty space of the scheduler?
You can see the problem in this codepen: https://codepen.io/TORISO/pen/GRNYqWL

Comment posted by Dan Letecky [DayPilot]
3 years ago.

Hi Tim,

You'll need to link the menu to the event (and to the Scheduler) by passing the event object to the show() method:

dp.onEventRightClick = args => {
  args.preventDefault();
  this.onShowContextMenu(args);
  dp.contextMenu.show(args.e);
};

The Scheduler will only close related menus when clicking the grid that has been disabled (timeRangeSelecting="Disabled").

Another option is to clear the menu using DayPilot.Menu.hide() call in onGridMouseDown event handler:

dp.onGridMouseDown = args => {
  DayPilot.Menu.hide();
};
Comment posted by Tim K.
3 years ago.

Thank`s for explanation, this fixed my issue. Glad to have you!

Comment posted by Dan Letecky [DayPilot]
3 years ago.

Great, thanks for the update!

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