The "set items" and "default options" menu hooks don't fire

Am I doing something wrong? See this demo:
https://jsfiddle.net/t8d5svg4/

No matter what I do these hooks never get called:

  • afterContextMenuDefaultOptions
  • beforeContextMenuSetItems
  • afterDropdownMenuDefaultOptions
  • beforeDropdownMenuSetItems

Am I not understanding when and how these hooks are supposed to fire, or are they broken?

This one should run, according to the docs

Fired by ContextMenu after setting up the Context Menu’s default options.
and the default settings are applied when we set contextMenu: true.

But… when I tried to find some info in the docs I found a comment

  • Updates the plugin state. This method is executed when {@link Core#updateSettings} is invoked.
    */

I’ll check the rest tomorrow and send you an update

Sorry for keeping you waiting. I was loaded with work.
I’m sure that you’ve already checked which hooks run on initialization, what are used when you run a custom build of a context menu and which are there in the console when you go from contextMenu: false to true. Nevertheless we should update the docs.

Ah, yes, that answers my question! Those hooks only fire if I change the contextMenu setting via updateSettings(). Seems a bit peculiar to me, not sure how I would use them if they don’t fire initially.

I’ll send the request over to our CTO to check if there is any reason why they don’t run in the first place and let you know his thoughts.

I already got a reply

plugins are using this hooks to add their options to the context menu.
example: you turn on hiddenColumns and it will add the show column option https://github.com/handsontable/handsontable/blob/6b531c3dc1421ec9a54ea3d14f95013f2c3fb85c/src/plugins/hiddenColumns/hiddenColumns.js#L548