AnsweredAssumed Answered

Adding Context Menu for each layer to nliu's TOC widget

Question asked by hawkeye81x on Jan 14, 2014
Latest reply on Feb 25, 2015 by fulhamish
I'm attempting to add a context menu to the TOC widget provided by nliu here:

I can get the context menu to appear however, it cannot see the data associated with the node.

// (Within the PostCreate function)
var pMenu;
pMenu = new Menu({});
pMenu.addChild(new MenuItem({
    label: "Turn On",
    onClick: this._manualTurnOn

// (Reference - Code above was added before this section shown below)
if (this.containerNode) {
    domStyle.set(this.containerNode, 'display', showChildren ? 'block' : 'none');

I add a _manualTurnOn function and was hoping to interact with the serviceLayer using this context menu (as well as some other functions later). However, when the function is triggered, there doesn't appear to be any context of the TOCNode object that was used to create the node this Menu is associates. It's clear I'm misunderstanding how this widget is structured (possibly even how widgets actually work).

Any clue how I might retrieve/interact with the underlying data associated with the node?