Scheduler 5.3.8 context menu bug


#1

Hi,
as you can see on your sample ,
when the mouse leave context menu item, the context menu disapeared, so user have to move mouse slowly to select an item

https://docs.dhtmlx.com/scheduler/samples/10_integration/01_dhtmlxmenu.html

tested on : chrome 73, edge chromium 83

scheduler version tested : 5.3.8, 5.3.7
dhtmlxsuite version tested : 6.4.x


#2

@Adil_Daicha
There seems to be 2 different kind of Menus

  • Scheduler dhtmlxMenu
  • Suite dhtmlxMenu

The Scheduler seems to be getting a major upgrade in the summer, which might also improve the Menu function.

For now, if you are using DHTMLSuite, please try the following code, where you can set also the position

		var menu = new dhtmlXMenuObject();
		
		menu.renderAsContextMenu();
		menu.data.parse([{
				value: "File",
				items: [
					{ value: "New File" },
					{ value: "New window" },
					{ value: "Open File" },
					{ value: "Save File" }
				]
			},
			{
				value: "Edit",
				items: [
					{ value: "Undo" },
					{ value: "Redo" },
					{ value: "Cut" },
					{ value: "Copy" }
				]
			}
		]);

		scheduler.attachEvent("onContextMenu", function (event_id, native_event_object) {
			if (event_id) {
				var posx = 0;
				var posy = 0;
				if (native_event_object.pageX || native_event_object.pageY) {
					posx = native_event_object.pageX;
					posy = native_event_object.pageY;
				} else if (native_event_object.clientX || native_event_object.clientY) {
					posx = native_event_object.clientX + document.body.scrollLeft + document
						.documentElement
						.scrollLeft;
					posy = native_event_object.clientY + document.body.scrollTop + document
						.documentElement
						.scrollTop;
				}
				menu.showContextMenu(posx, posy);
				return false; // prevent default action and propagation
			}
			return true;
		});

This should fix your issue.

Also you can feed your menu with loadSctruc and configure the structure in an xml format with icons and so on.
Here’s an example with suite 5


#3

Hi, thank you for your answer, but we use suite 6

And adding suite 5 for only this will cost weight :slight_smile:

I will try to adapt your event code with suite 6, and expect the new release :sunny:


#4

It should also work with suite 6, but I havent tried


#5

Please, try to change the navigationType of the dhtmlxMenu, as the default is “pointer”
https://docs.dhtmlx.com/suite/menu__api__menu_navigationtype_config.html

var menu = new dhx.ContextMenu();

replace with

var menu = new dhx.ContextMenu(null,{navigationType:"click"});

#6

yeah work as expected , big thanks :blush: