Integration ContextMenu with jQuery FullCalendar

I use Adam Shaw control FullCalendaralong with jQuery. I would like to add a context menu to events and days. I was able to achieve this using Content Management in the Martin Wendt menu . My code for registering a menu in events is as follows:

$('#calendar').fullCalendar({
        // Other arguments
        eventRender: function (event, element) {
            var originalClass = element[0].className;
            element[0].className = originalClass + ' hasmenu';
        },
        dayRender: function (day, cell) {
            var originalClass = cell[0].className;
            cell[0].className = originalClass + ' hasmenu';
    });
});

I add a class hasmenuto each event and day on the calendar.

$(document).contextmenu({
    delegate: ".hasmenu",
    preventContextMenuForPopup: true,
    preventSelect: true,
    menu: [
            {title: "Cut", cmd: "cut", uiIcon: "ui-icon-scissors"},
            {title: "Copy", cmd: "copy", uiIcon: "ui-icon-copy"},
            {title: "Paste", cmd: "paste", uiIcon: "ui-icon-clipboard", disabled: true },
        ],
    select: function(event, ui) {
            // Logic for handing the selected option
    },
    beforeOpen: function(event, ui) {
            // Things to happen right before the menu pops up
    }
});

The problem is that the menu appears behind the calendar control. I believe that this is due to the fact that in calendar events there are several other classes assigned to them, and adding a class is hasmenumessing with them. When I set a breakpoint in VS, it says the event has these classes:

"fc-event fc-event-hori fc-event-draggable fc-event-start fc-event-end hasmenu"

And this is how it looks on the page:

enter image description here

hasmenu, , . ? " "? .

+4
3

z-index, , .

+3

z-index beforeOpen

beforeOpen: function (event, ui) {      
    ui.menu.zIndex($(event.target).zIndex() + 1);
}

. : https://github.com/mar10/jquery-ui-contextmenu/issues/55

+4

:

beforeOpen: function (event, ui) {
            var $menu = ui.menu,
                $target = ui.target;
            ui.menu.css('z-index', '10000000');
            // Things to happen right before the menu pops up
        }
0

All Articles