dojox/grid/enhanced/plugins/Menu.js

  • Provides:

    • dojox.grid.enhanced.plugins.Menu
  • Requires:

    • dojox.grid.enhanced._Plugin in common
  • dojox.grid.enhanced.plugins.Menu

    • type
      Function
    • chains:
      • dojox.grid.enhanced._Plugin: (prototype)
      • dojox.grid.enhanced._Plugin: (call)
    • summary
      Provides context menu support, including header menu, row menu, cell menu and selected region menu
    • example
      <div dojoType="dojox.grid.EnhancedGrid"
      plugins="{menus:{headerMenu:"headerMenuId", rowMenu:"rowMenuId", cellMenu:"cellMenuId",
      selectedRegionMenu:"selectedRegionMenuId"}}" ...>
      </div>
    • source: [view]
        var g = this.grid;
        g.showMenu = dojo.hitch(g, this.showMenu);
        g._setRowMenuAttr = dojo.hitch(this, '_setRowMenuAttr');
        g._setCellMenuAttr = dojo.hitch(this, '_setCellMenuAttr');
        g._setSelectedRegionMenuAttr = dojo.hitch(this, '_setSelectedRegionMenuAttr');
  • dojox.grid.enhanced.plugins.Menu.name

    • tags: const
    • type
      Array
    • summary
      menu types
  • dojox.grid.enhanced.plugins.Menu.types

    • summary
  • dojox.grid.enhanced.plugins.Menu.onStartUp

    • type
      Function
    • source: [view]
        var type, option = this.option;
        for(type in option){
         if(dojo.indexOf(this.types, type) >= 0 && option[type]){
          this._initMenu(type, option[type]);
         }
        }
    • summary
  • dojox.grid.enhanced.plugins.Menu._initMenu

    • type
      Function
    • parameters:
      • menuType: (typeof String)
      • menu: (typeof String | Widget(dijit.Menu))
    • source: [view]
        var g = this.grid;
        if(!g[menuType]){//in case already created in _Grid.postCreate()
         var m = this._getMenuWidget(menu);
         if(!m){return;}
         g.set(menuType, m);
         if(menuType != "headerMenu"){
          m._scheduleOpen = function(){return;};
         }
        }
    • summary
  • dojox.grid.enhanced.plugins.Menu._getMenuWidget

    • type
      Function
    • parameters:
      • menu: (typeof String|Widget(dijit.Menu))
    • source: [view]
        return (menu instanceof dijit.Menu) ? menu : dijit.byId(menu);
    • summary
      Fetch the required menu widget(should already been created)
  • dojox.grid.enhanced.plugins.Menu._setRowMenuAttr

    • type
      Function
    • parameters:
      • menu: (typeof Widget(dijit.Menu))
    • source: [view]
        this._setMenuAttr(menu, 'rowMenu');
    • summary
      Set row menu widget
  • dojox.grid.enhanced.plugins.Menu._setCellMenuAttr

    • type
      Function
    • parameters:
      • menu: (typeof Widget(dijit.Menu))
    • source: [view]
        this._setMenuAttr(menu, 'cellMenu');
    • summary
      Set cell menu widget
  • dojox.grid.enhanced.plugins.Menu._setSelectedRegionMenuAttr

    • type
      Function
    • parameters:
      • menu: (typeof Widget(dijit.Menu))
    • source: [view]
        this._setMenuAttr(menu, 'selectedRegionMenu');
    • summary
      Set row menu widget
  • dojox.grid.enhanced.plugins.Menu._setMenuAttr

    • type
      Function
    • parameters:
      • menu: (typeof Widget(dijit.Menu))
      • menuType: (typeof String)
    • source: [view]
        var g = this.grid, n = g.domNode;
        if(!menu || !(menu instanceof dijit.Menu)){
         console.warn(menuType, " of Grid ", g.id, " is not existed!");
         return;
        }
        if(g[menuType]){
         g[menuType].unBindDomNode(n);
        }
        g[menuType] = menu;
        g[menuType].bindDomNode(n);
    • summary
      Bind menus to Grid.
  • dojox.grid.enhanced.plugins.Menu.showMenu

    • type
      Function
    • parameters:
      • e: (typeof Event)
    • source: [view]
        var inSelectedRegion = (e.cellNode && dojo.hasClass(e.cellNode, 'dojoxGridRowSelected') ||
         e.rowNode && (dojo.hasClass(e.rowNode, 'dojoxGridRowSelected') || dojo.hasClass(e.rowNode, 'dojoxGridRowbarSelected')));

        
        if(inSelectedRegion && this.selectedRegionMenu){
         this.onSelectedRegionContextMenu(e);
         return;
        }

        
        var info = {target: e.target, coords: e.keyCode !== dojo.keys.F10 && "pageX" in e ? {x: e.pageX, y: e.pageY } : null};
        if(this.rowMenu && (!this.cellMenu || this.selection.isSelected(e.rowIndex) || e.rowNode && dojo.hasClass(e.rowNode, 'dojoxGridRowbar'))){
         this.rowMenu._openMyself(info);
         dojo.stopEvent(e);
         return;
        }


        if(this.cellMenu){
         this.cellMenu._openMyself(info);
        }
        dojo.stopEvent(e);
    • summary
      Show appropriate context menu
      Fired from dojox.grid.enhanced._Events.onRowContextMenu, 'this' scope - Grid
      TODO: test Shift-F10
  • dojox.grid.enhanced.plugins.Menu.destroy

    • type
      Function
    • source: [view]
        var g = this.grid;
        if(g.headerMenu){g.headerMenu.unBindDomNode(g.viewsHeaderNode);}
        if(g.rowMenu){g.rowMenu.unBindDomNode(g.domNode);}
        if(g.cellMenu){g.cellMenu.unBindDomNode(g.domNode);}
        if(g.selectedRegionMenu){g.selectedRegionMenu.destroy();}
        this.inherited(arguments);
    • summary
      Destroy all resources.
      _Grid.destroy() will unbind headerMenu
  • dojox.grid.enhanced.plugins

    • type
      Object
    • summary
  • dojox.grid.enhanced

    • type
      Object
    • summary
  • dojox.grid

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary