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