dijit/_Container.js

  • Provides:

    • dijit._Container
  • dijit._Container

    • type
      Function
    • summary
      Mixin for widgets that contain a set of widget children.
    • description
      Use this mixin for widgets that needs to know about and
      keep track of their widget children. Suitable for widgets like BorderContainer
      and TabContainer which contain (only) a set of child widgets.
      
      It's not suitable for widgets like ContentPane
      which contains mixed HTML (plain DOM nodes in addition to widgets),
      and where contained widgets are not necessarily directly below
      this.containerNode.   In that case calls like addChild(node, position)
      wouldn't make sense.
  • dijit._Container.isContainer

    • tags: protected
    • type
      Boolean
    • summary
      Indicates that this widget acts as a "parent" to the descendant widgets.
      When the parent is started it will call startup() on the child widgets.
      See also `isLayoutContainer`.
  • dijit._Container.buildRendering

    • type
      Function
    • source: [view]
         this.inherited(arguments);
         if(!this.containerNode){
          // all widgets with descendants must set containerNode
            this.containerNode = this.domNode;
         }
    • summary
  • dijit._Container.addChild

    • type
      Function
    • parameters:
      • widget: (typeof dijit._Widget)
      • insertIndex: (typeof int)
    • source: [view]
         var refNode = this.containerNode;
         if(insertIndex && typeof insertIndex == "number"){
          var children = this.getChildren();
          if(children && children.length >= insertIndex){
           refNode = children[insertIndex-1].domNode;
           insertIndex = "after";
          }
         }
         dojo.place(widget.domNode, refNode, insertIndex);


         // If I've been started but the child widget hasn't been started,
         // start it now. Make sure to do this after widget has been
         // inserted into the DOM tree, so it can see that it's being controlled by me,
         // so it doesn't try to size itself.
         if(this._started && !widget._started){
          widget.startup();
         }
    • summary
      Makes the given widget a child of this widget.
    • description
      Inserts specified child widget's dom node as a child of this widget's
      container node, and possibly does other processing (such as layout).
  • dijit._Container.removeChild

    • type
      Function
    • parameters:
      • widget: (typeof Widget or int)
    • source: [view]
         if(typeof widget == "number"){
          widget = this.getChildren()[widget];
         }


         if(widget){
          var node = widget.domNode;
          if(node && node.parentNode){
           node.parentNode.removeChild(node); // detach but don't destroy
          }
         }
    • summary
      Removes the passed widget instance from this widget but does
      not destroy it.  You can also pass in an integer indicating
      the index within the container to remove
  • dijit._Container.hasChildren

    • type
      Function
    • source: [view]
         return this.getChildren().length > 0; // Boolean
    • summary
      Returns true if widget has children, i.e. if this.containerNode contains something.
    • returns
      Boolean
  • dijit._Container.destroyDescendants

    • type
      Function
    • parameters:
      • preserveDom: (typeof Boolean)
    • source: [view]
         dojo.forEach(this.getChildren(), function(child){ child.destroyRecursive(preserveDom); });
    • summary
      Destroys all the widgets inside this.containerNode,
      but not this widget itself
  • dijit._Container._getSiblingOfChild

    • type
      Function
    • parameters:
      • child: (typeof dijit._Widget)
      • dir: (typeof int)
        if 1, get the next sibling
        if -1, get the previous sibling
    • source: [view]
         var node = child.domNode,
          which = (dir>0 ? "nextSibling" : "previousSibling");
         do{
          node = node[which];
         }while(node && (node.nodeType != 1 || !dijit.byNode(node)));
         return node && dijit.byNode(node); // dijit._Widget
    • summary
      Get the next or previous widget sibling of child
    • tags:
    • returns
      dijit._Widget
  • dijit._Container.getIndexOfChild

    • type
      Function
    • parameters:
      • child: (typeof dijit._Widget)
    • source: [view]
         return dojo.indexOf(this.getChildren(), child); // int
    • summary
      Gets the index of the child in this container or -1 if not found
    • returns
      int
  • dijit._Container.startup

    • type
      Function
    • source: [view]
         if(this._started){ return; }


         // Startup all children of this widget
         dojo.forEach(this.getChildren(), function(child){ child.startup(); });


         this.inherited(arguments);
    • summary
      Called after all the widgets have been instantiated and their
      dom nodes have been inserted somewhere under dojo.doc.body.
      
      Widgets should override this method to do any initialization
      dependent on other widgets existing, and then call
      this superclass method to finish things off.
      
      startup() in subclasses shouldn't do anything
      size related because the size of the widget hasn't been set yet.
  • dijit._Container.containerNode

    • summary
  • dijit

    • type
      Object
    • summary