You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to change the enabled state of a menu item for an open menu without recreating the menu.
I tried using a custom function for the disabled attribute which returned a variable's value and then changing the variable and calling $(root).contextMenu(). This only caused the update to take effect if I closed and then opened the context menu again.
Some debugging makes it appear to work because when you click the toggle item it will internally call op.update causing the menu to be updated? I have copied this code to achieve the dynamic update ending up with this:
Interesting way of doing it. Seems like the right way of doing it. Thing is, if i make this public, i'm not sure it won't act strange, especially with the states of input elements.
Ok thanks for the response. I'm going to go with it for now, I'll update here if I run into any problems with this approach. So far it's working ok with simple callback menu items and sub menus. I have not used any input elements.
Hi,
I want to be able to change the enabled state of a menu item for an open menu without recreating the menu.
I tried using a custom function for the disabled attribute which returned a variable's value and then changing the variable and calling $(root).contextMenu(). This only caused the update to take effect if I closed and then opened the context menu again.
I see in the demos there is an example of changing whether a menu item is disabled without recreating the menu here: https://swisnl.github.io/jQuery-contextMenu/demo/disabled-changing.html
Some debugging makes it appear to work because when you click the toggle item it will internally call op.update causing the menu to be updated? I have copied this code to achieve the dynamic update ending up with this:
This appears to work but I'm a bit hesitant diving in to stuff not in the documentation. Is there another way to achieve what I'm looking to do?
Thanks
The text was updated successfully, but these errors were encountered: