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