fix attribute
[roojs1] / examples / dialog / hello.js
index 90b63f4..ad6d5c7 100644 (file)
@@ -13,7 +13,7 @@ Roo.BLANK_IMAGE_URL  = "../../images/default/s.gif";
 
 
 
-HelloWorld = {
+var HelloWorld = {
 
     dialog : false,
     callback:  false,
@@ -41,7 +41,7 @@ HelloWorld = {
         var _this = this;
         this.dialog = Roo.factory({
             xns : Roo,
-            xtype : 'BasicDialog',
+            xtype : 'LayoutDialog',
             autoTabs:true,
             width:500,
             height:300,
@@ -49,6 +49,29 @@ HelloWorld = {
             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',
@@ -59,8 +82,7 @@ HelloWorld = {
                             _this.dialog.hide()
                         }   
                     }
-                }
-                buttons : [
+                },
                 {
                     xtype : 'Button',
                     xns : Roo,
@@ -71,55 +93,19 @@ HelloWorld = {
                         }   
                     }
                 }
-            ],
-            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