Closed dwitvliet closed 7 years ago
When using the build
option, the menu is built every time you open the menu, wouldn't that fix your problem?
https://swisnl.github.io/jQuery-contextMenu/demo/dynamic-create.html
Hi, thank you for the quick response!
Sorry, I wasn't specific enough in my original post. I am looking for a function that allows updating the contextMenu elements while the contextMenu is visible (so the visible
and disabled
functions are run again). The build
option would require the menu to be hidden and then be rebuilt in order to update the menu.
First off, thanks for such an amazing plugin. To add to this topic, I believe an update option would be wonderful, as I've noticed that if you do something
div class='something' Stuff and thangs. div
And then bind a context menu on the something class, all works well. However, this only occurs if the element is already in the dom. For dynamically created elements, or for elements that may get moved in and out of the dom via ajax calls, the context menu no longer works as the element was in the dom during the initial context menu call.
I've been through the documentation of the plugin, and as far as I can tell no method for this desired behavior works. Perhaps I'm just missing something, but it seems like a way to update element binds is the way to go.
I've added a feature to support updating the menu. See: http://swisnl.github.io/jQuery-contextMenu/docs.html#update-contextmenu-state
Hi, There are various triggers for manually manipulating the contextMenu. However, there is currently no easy way to trigger an update of the elements in the contextMenu. It would be great for plugins to be able to update the elements, e.g. with
$(".some-selector").contextMenu("update");
.