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                 xns : Roo,
27                 xtype : 'LayoutRegion'
28             },
29             items : [
30                 {
31                     xtype: 'ContentPanel',
32                     xns : Roo,
33                     region : "center",
34                     title : "Grid Panel Title"
35                 }
36             ],
37             // items: [
38             //     {
39             //         xtype : 'UploadCropbox',
40             //         xns : Roo.dialog,
41             //         minWidth : 60,
42             //         minHeight: 40,
43             //         listeners : {
44             //             arrange : function (_self, formData)
45             //             {
46             //                 console.log("ARRANGE");
47             //                 console.log(formData);
48             //             },
49             //             crop : function (_self, data)
50             //             {
51             //                 console.log("CROP");
52             //                 console.log(data);
53             //             },
54             //             resize : function (_self)
55             //             {
56             //                 console.log("RESIZE");
57             //             },
58             //             rotate : function (_self)
59             //             {
60             //                 console.log("ROTATE");
61             //             },
62             //             render : function (_self)
63             //             {
64             //                 console.log("RENDER");
65             //                 console.log(_self);
66             //                 _this.cropbox = _self;
67             //             }
68         
69             //         }
70             //     }
71             // ],
72             buttons : [
73                 {
74                     xtype : 'Button',
75                     xns : Roo,
76                     text : 'Submit',
77                     listeners : {
78                         click : function () {
79                             _this.dialog.hide()
80                         }   
81                     }
82                 },
83                 {
84                     xtype : 'Button',
85                     xns : Roo,
86                     text : 'Close',
87                     listeners : {
88                         click : function () {
89                             _this.dialog.hide()
90                         }   
91                     }
92                 }
93             ]
94         });
95     }
96 }
97
98 Roo.onReady(function() {
99     
100     Roo.get('show-dialog-btn').on('click',function () {
101         test.show({});
102         console.log(test);
103     });
104 });