examples/dialog/test-2.js
[roojs1] / examples / dialog / test-2.js
1 var test = {
2
3     dialog : false,
4     callback : false,
5
6     show : function(data, cb)
7     {
8         if (!this.dialog) {
9             this.create();
10         }
11
12         this.callback = cb;
13         this.data = data;
14         this.dialog.show();
15     },
16
17     create : function()
18     {
19         var _this = this;
20         this.dialog = Roo.factory({
21             xns : Roo,
22             xtype : 'LayoutDialog',
23             width: 600,
24             height: 450,
25             center : {
26                 xtype : 'LayoutRegion',
27                 alwaysShowTabs : true,
28                 tabPosition : 'top',
29                 xns : Roo,
30                 '|xns' : 'Roo'
31             },
32             // items: [
33             //     {
34             //         xtype : 'UploadCropbox',
35             //         xns : Roo.dialog,
36             //         minWidth : 60,
37             //         minHeight: 40,
38             //         listeners : {
39             //             arrange : function (_self, formData)
40             //             {
41             //                 console.log("ARRANGE");
42             //                 console.log(formData);
43             //             },
44             //             crop : function (_self, data)
45             //             {
46             //                 console.log("CROP");
47             //                 console.log(data);
48             //             },
49             //             resize : function (_self)
50             //             {
51             //                 console.log("RESIZE");
52             //             },
53             //             rotate : function (_self)
54             //             {
55             //                 console.log("ROTATE");
56             //             },
57             //             render : function (_self)
58             //             {
59             //                 console.log("RENDER");
60             //                 console.log(_self);
61             //                 _this.cropbox = _self;
62             //             }
63         
64             //         }
65             //     }
66             // ],
67             buttons : [
68                 {
69                     xtype : 'Button',
70                     xns : Roo,
71                     text : 'Submit',
72                     listeners : {
73                         click : function () {
74                             _this.dialog.hide()
75                         }   
76                     }
77                 },
78                 {
79                     xtype : 'Button',
80                     xns : Roo,
81                     text : 'Close',
82                     listeners : {
83                         click : function () {
84                             _this.dialog.hide()
85                         }   
86                     }
87                 }
88             ]
89         });
90     }
91 }
92
93 Roo.onReady(function() {
94     
95     Roo.get('show-dialog-btn').on('click',function () {
96         test.show({});
97         console.log(test);
98     });
99 });