dojox
Version:
Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.
49 lines (40 loc) • 1.28 kB
JavaScript
define([
"dojo/_base/declare",
"dojo/_base/window",
"dojo/dom-style",
"./PortletSettings",
"dijit/Dialog"
], function(declare, window, domStyle, PortletSettings, Dialog){
return declare("dojox.widget.PortletDialogSettings", [PortletSettings],{
// summary:
// A settings widget to be used with a dojox.widget.Portlet, which displays
// the contents of this widget in a dijit.Dialog box.
// dimensions: Array
// The size of the dialog to display. This defaults to [300, 300]
dimensions: null,
constructor: function(props, node){
this.dimensions = props.dimensions || [300, 100];
},
toggle: function(){
// summary:
// Shows and hides the Dialog box.
if(!this.dialog){
//require("dijit.Dialog");
this.dialog = new Dialog({title: this.title});
window.body().appendChild(this.dialog.domNode);
// Move this widget inside the dialog
this.dialog.containerNode.appendChild(this.domNode);
domStyle.set(this.dialog.domNode,{
"width" : this.dimensions[0] + "px",
"height" : this.dimensions[1] + "px"
});
domStyle.set(this.domNode, "display", "");
}
if(this.dialog.open){
this.dialog.hide();
}else{
this.dialog.show(this.domNode);
}
}
});
});