initial import
[roojs1] / examples / dialog / hello.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11
12 Roo.BLANK_IMAGE_URL  = "../../images/default/s.gif";
13  \r
14 // create the HelloWorld application (single instance)\r
15 var HelloWorld = function(){\r
16     // everything in this space is private and only accessible in the HelloWorld block\r
17     \r
18     // define some private variables\r
19     var dialog, showBtn;\r
20     \r
21     // return a public interface\r
22     return {\r
23         init : function(){\r
24              showBtn = Roo.get('show-dialog-btn');\r
25              // attach to click event\r
26              showBtn.on('click', this.showDialog, this);\r
27         },\r
28        \r
29         showDialog : function(){\r
30             if(!dialog){ // lazy initialize the dialog and only create it once\r
31                 dialog = new Roo.BasicDialog("hello-dlg", { \r
32                         autoTabs:true,\r
33                         width:500,\r
34                         height:300,\r
35                         shadow:true,\r
36                         minWidth:300,\r
37                         minHeight:250,\r
38                         proxyDrag: true\r
39                 });\r
40                 dialog.addKeyListener(27, dialog.hide, dialog);\r
41                 dialog.addButton('Submit', dialog.hide, dialog).disable();\r
42                 dialog.addButton('Close', dialog.hide, dialog);\r
43             }\r
44             dialog.show(showBtn.dom);\r
45         }\r
46     };\r
47 }();\r
48 \r
49 // using onDocumentReady instead of window.onload initializes the application\r
50 // when the DOM is ready, without waiting for images and other resources to load\r
51 Roo.onReady(HelloWorld.init, HelloWorld, true);