Closed isbadawi closed 10 years ago
FYI, you can use scopes
options for this. See https://github.com/sydcanem/bootstrap-contextmenu/issues/56.
Ah, great, thanks! I'd seen the scopes
option mentioned in the README but hadn't really understood what it meant.
I have a sort of tree view -- it's a bunch of nested uls inside a div at the top-level. When I open the context menu on a tree item and select a menu item,
onItem
is invoked and thecontext
argument is always set to the whole div, not the specific item (e.g. the li, or the span in the li's label) that was right-clicked.My current workaround is to use
$(document.elementFromPoint(e.clientX, e.clientY))
in the before handler, but this seems a bit hacky. Is there another way to get at the clicked element?