swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

Extend Context Menu after build #705

Closed patrickluethi closed 4 years ago

patrickluethi commented 4 years ago

Is it possible to add new items to the ContextMenu after it was build?

JaZo commented 4 years ago

You can use the build option to create the context menu on demand, but once it's open you can't add new items.

patrickluethi commented 4 years ago

So there is no way i can add an item to items after the build?

JaZo commented 4 years ago

The method you specify in the build option is called every time the context menu is opened so you can define the items based on some runtime variable. Once your method returns the items and the context menu is open/visible you can't add new items until the menu is reopened and the build method is called again. Please see https://swisnl.github.io/jQuery-contextMenu/docs.html#build.

patrickluethi commented 4 years ago

Okay, thank you!