dojox/widget/PlaceholderMenuItem.js

  • Provides:

    • dojox.widget.PlaceholderMenuItem
  • Requires:

    • dijit.Menu in common in project dijit
  • dojox.widget.PlaceholderMenuItem

    • type
      Function
    • chains:
      • dijit.MenuItem: (prototype)
      • dijit.MenuItem: (call)
    • summary
      A menu item that can be used as a placeholder.  Set the label
      of this item to a unique key and you can then use it to add new
      items at that location.  This item is not displayed.
  • dojox.widget.PlaceholderMenuItem._replaced

    • summary
  • dojox.widget.PlaceholderMenuItem._replacedWith

    • summary
  • dojox.widget.PlaceholderMenuItem._isPlaceholder

    • summary
  • dojox.widget.PlaceholderMenuItem.postCreate

    • type
      Function
    • source: [view]
        this.domNode.style.display = "none";
        this._replacedWith = [];
        if(!this.label){
         this.label = this.containerNode.innerHTML;
        }
        this.inherited(arguments);
    • summary
  • dojox.widget.PlaceholderMenuItem.replace

    • type
      Function
    • parameters:
      • menuItems: (typeof dijit.MenuItem[])
    • source: [view]
        if(this._replaced){ return false; }


        var index = this.getIndexInParent();
        if(index < 0){ return false; }


        var p = this.getParent();


        dojo.forEach(menuItems, function(item){
         p.addChild(item, index++);
        });
        this._replacedWith = menuItems;


        this._replaced = true;
        return true;
    • summary
      replaces this menu item with the given menuItems.  The original
      menu item is not actually removed from the menu - so if you want
      it removed, you must do that explicitly.
    • return_summary
      true if the replace happened, false if not
  • dojox.widget.PlaceholderMenuItem.unReplace

    • type
      Function
    • parameters:
      • destroy: (typeof Boolean)
        Also call destroy on any removed items.
    • source: [view]
        if(!this._replaced){ return []; }


        var p = this.getParent();
        if(!p){ return []; }


        var r = this._replacedWith;
        dojo.forEach(this._replacedWith, function(item){
         p.removeChild(item);
         if(destroy){
          item.destroyRecursive();
         }
        });
        this._replacedWith = [];
        this._replaced = false;


        return r; // dijit.MenuItem[]
    • summary
      Removes menu items added by calling replace().  It returns the
      array of items that were actually removed (in case you want to
      clean them up later)
    • return_summary
      The array of items that were actually removed
    • returns
      dijit.MenuItem[]
  • dojox.widget.PlaceholderMenuItem.domNode.style.display

    • summary
  • dojox.widget.PlaceholderMenuItem.label

    • summary
  • dijit.Menu.getPlaceholders

    • type
      Function
    • parameters:
      • label: (typeof String)
        Label to search for - if not specified, then all placeholders
        are returned
    • source: [view]
        var r = [];


        var children = this.getChildren();
        dojo.forEach(children, function(child){
         if(child._isPlaceholder && (!label || child.label == label)){
          r.push(child);
         }else if(child._started && child.popup && child.popup.getPlaceholders){
          r = r.concat(child.popup.getPlaceholders(label));
         }else if(!child._started && child.dropDownContainer){
          var node = dojo.query("[widgetId]", child.dropDownContainer)[0];
          var menu = dijit.byNode(node);
          if(menu.getPlaceholders){
           r = r.concat(menu.getPlaceholders(label));
          }
         }
        }, this);
        return r; // dojox.widget.PlaceholderMenuItem[]
    • summary
      Returns an array of placeholders with the given label.  There
      can be multiples.
    • return_summary
      An array of placeholders that match the given label
    • returns
      dojox.widget.PlaceholderMenuItem[]
  • dojox.widget

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary