dijit.layout.SplitContainer.layout
dojo.require("dijit.layout.SplitContainer");
defined in dijit/layout/SplitContainer.js
Do layout of panels
Usage
function () (view source)
// base class defines this._contentBox on initial creation and also // on resize this.paneWidth = this._contentBox.w; this.paneHeight = this._contentBox.h; var children = this.getChildren(); if(!children.length){ return; } // // calculate space // var space = this.isHorizontal ? this.paneWidth : this.paneHeight; if(children.length > 1){ space -= this.sizerWidth * (children.length - 1); } // // calculate total of SizeShare values // var outOf = 0; dojo.forEach(children, function(child){ outOf += child.sizeShare; }); // // work out actual pixels per sizeshare unit // var pixPerUnit = space / outOf; // // set the SizeActual member of each pane // var totalSize = 0; dojo.forEach(children.slice(0, children.length - 1), function(child){ var size = Math.round(pixPerUnit * child.sizeShare); child.sizeActual = size; totalSize += size; }); children[children.length-1].sizeActual = space - totalSize; // // make sure the sizes are ok // this._checkSizes(); // // now loop, positioning each pane and letting children resize themselves // var pos = 0; var size = children[0].sizeActual; this._movePanel(children[0], pos, size); children[0].position = pos; pos += size; // if we don't have any sizers, our layout method hasn't been called yet // so bail until we are called..TODO: REVISIT: need to change the startup // algorithm to guaranteed the ordering of calls to layout method if(!this.sizers){ return; } dojo.some(children.slice(1), function(child, i){ // error-checking if(!this.sizers[i]){ return true; } // first we position the sizing handle before this pane this._moveSlider(this.sizers[i], pos, this.sizerWidth); this.sizers[i].position = pos; pos += this.sizerWidth; size = child.sizeActual; this._movePanel(child, pos, size); child.position = pos; pos += size; }, this);