-HelloWorld = {
+var HelloWorld = {
dialog : false,
callback: false,
var _this = this;
this.dialog = Roo.factory({
xns : Roo,
- xtype : 'BasicDialog',
+ xtype : 'LayoutDialog',
autoTabs:true,
width:500,
height:300,
minWidth:300,
minHeight:250,
proxyDrag: true,
+ listeners : {
+ show : function() {
+ var p = this.layout.getRegion('center').getPanel(0);
+ p.setContent("Hello World");
+
+ },
+ keydown : function(dlg, e) {
+ var k = e.getKey();
+ if(k == 27){ _this.dialog.hide(); }
+ }
+ },
+ center : {
+ xtype: 'LayoutRegion',
+ xns: Roo
+ },
+ items : [
+ {
+ xtype: 'ContentPanel',
+ xns: Roo,
+ region : "center"
+
+ }
+ ],
buttons : [
{
xtype : 'Button',
_this.dialog.hide()
}
}
- }
- buttons : [
+ },
{
xtype : 'Button',
xns : Roo,
}
}
}
- ],
- listeners : {
- keydown : function(dlg, e) {
- var k = e.getKey();
- if(k == 27){ _this.dialog.hide(); }
- }
- }
+ ]
});
}
-}
-
-\r
-// create the HelloWorld application (single instance)\r
-var HelloWorld = function(){\r
- // everything in this space is private and only accessible in the HelloWorld block\r
- \r
- // define some private variables\r
- var dialog, showBtn;\r
- \r
- // return a public interface\r
- return {\r
- init : function(){\r
- showBtn = Roo.get('show-dialog-btn');\r
- // attach to click event\r
- showBtn.on('click', this.showDialog, this);\r
- },\r
- \r
- showDialog : function(){\r
- if(!dialog){ // lazy initialize the dialog and only create it once\r
- dialog = new Roo.BasicDialog("hello-dlg", { \r
- autoTabs:true,\r
- width:500,\r
- height:300,\r
- shadow:true,\r
- minWidth:300,\r
- minHeight:250,\r
- proxyDrag: true\r
- });\r
- dialog.addKeyListener(27, dialog.hide, dialog);\r
- dialog.addButton('Submit', dialog.hide, dialog).disable();\r
- dialog.addButton('Close', dialog.hide, dialog);\r
- }\r
- dialog.show(showBtn.dom);\r
- }\r
- };\r
-}();\r
+};
+ \r
\r
// using onDocumentReady instead of window.onload initializes the application\r
// when the DOM is ready, without waiting for images and other resources to load\r
-Roo.onReady(HelloWorld.init, HelloWorld, true);
\ No newline at end of file
+Roo.onReady(function() {
+
+ Roo.get('show-dialog-btn').on('click',function () {
+ HelloWorld.show({ _el : this});
+ });
+});
\ No newline at end of file