ScrollingTable inside context menu

I am using a ScrollingTable inside context menu, everything works except scroll, when I try to scroll the list the context menu closes, is there a way to avoid this, or close context menu only on clicking outside of it ?

You could change the two click event handlers of the scrollbar buttons to set InputEvent.handled to true:

    click: function(e, obj) { e.handled = true; incrTableIndex(obj, -1); }

Sorry Walter but i didn’t get it. The default behaviour of context menu is that if you click on it, it closes, i just want to avoid that and it should closes only when the user clicks on empty area of the diagram.

Oh, I thought you were asking how to avoid having a click that scrolls the table from clicking on the menu and thus invoking its command and closing the menu.

OK, so you aren’t actually asking about ScrollingTable at all. I suppose you could override ContextMenuTool.doMouseUp to do what you want. It depends on what you want to do in many different possible circumstances.

Maybe this is what you want:

      $(go.Diagram, . . .,
          "contextMenuTool.doMouseUp": function() {
            if (!this.isActive) {
            } else {
              var menu = this.currentContextMenu;
              if (menu === null) return;
              if (menu instanceof go.HTMLInfo) {
                this.stopTool();  // still want to call stopTool here
              } else { // menu is an Adornment
                var diagram = this.diagram;
                var currobj = diagram.findObjectAt(diagram.lastInput.documentPoint, null, null);
                if (currobj !== null && currobj.isContainedBy(menu)) {
                  // click on a context menu button
                  this.standardMouseClick(null, null);
                } else {
                  this.stopTool();  // still want to call stopTool here
              // this.stopTool();  // but no longer call stopTool here
              // maybe start another context menu
              if (this.canStart()) {
                diagram.currentTool = this;