0
votes

When does Kendo context menu get anchored? My problem is the context menu opens in slightly the wrong spot. I have the alignToAnchor set to true. Everything works except when I am adding the first item in the grid. Then the context menu is slightly off. The problem is likely because I have custom row templates and I have to add a custom header as well. The custom header throws it off. This behavior isn't just on the first time that the user right-clicks on the row. It is always when the user right-clicks on the row. And then with a refresh on the page, a right-click on that record puts the contextMenu in the right place.

Here are a couple of things that I've tried:

1) Destroying the contextMenu and reinitializing after the first record is created.

2) Adding a class to all the rows noContextMenu. Change the filter on the contextMenu to tr:not(.noContextMenu) and then adding a line to the end of the dataBound: $(".noContextMenu").removeClass("noContextMenu"); (So then, the noContextMenu class is only in effect during popup editing.)

3) Digging into the contextMenu object and overwriting the target variable.

1

1 Answers

0
votes

See if that workaround will work for you:

$("#context-menu").kendoContextMenu({
    open: function(e) {
      setTimeout(function() {
          e.sender.element.parent().css('top', e.event.pageY).css('left', e.event.pageX);
      });
    }
    ...
});