Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.bjs
1 {
2     "id": "roo-file-208",
3     "name": "Pman.Dialog.CoreAutoSavePreview",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    if(typeof(_this.data) != 'undefined'){\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
11             },
12             "background": false,
13             "closable": false,
14             "collapsible": false,
15             "height": 500,
16             "modal": true,
17             "resizable": false,
18             "title": "Saved Version",
19             "width": 800,
20             "xtype": "LayoutDialog",
21             "|xns": "Roo",
22             "items": [
23                 {
24                     "*prop": "center",
25                     "xtype": "LayoutRegion",
26                     "|xns": "Roo"
27                 },
28                 {
29                     "*prop": "west",
30                     "split": true,
31                     "width": 200,
32                     "xtype": "LayoutRegion",
33                     "|xns": "Roo"
34                 },
35                 {
36                     "listeners": {
37                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
38                     },
39                     "background": false,
40                     "fitContainer": true,
41                     "fitToframe": true,
42                     "region": "west",
43                     "tableName": "Events",
44                     "title": "Events",
45                     "xtype": "GridPanel",
46                     "|xns": "Roo",
47                     "items": [
48                         {
49                             "listeners": {
50                                 "|render": "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
51                             },
52                             "*prop": "grid",
53                             "autoExpandColumn": "event_when",
54                             "loadMask": true,
55                             "xtype": "Grid",
56                             "|xns": "Roo.grid",
57                             "items": [
58                                 {
59                                     "listeners": {
60                                         "afterselectionchange": "function (_self)\n{\n    var selected = this.getSelected();\n    \n    _this.viewPanel.load( { url : baseURL + \"/Roo/Events\", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){\n        \n        _this.source = '';\n        \n        var res = Roo.decode(oResponse.responseText);\n        \n        if(!bSuccess || !res.success){\n            _this.viewPanel.setContent(\"Load data failed?!\");\n        }\n        \n        if(typeof(res.data) === 'string'){\n            _this.viewPanel.setContent(res.data);\n            return;\n        }\n        \n        if(!_this.data.successFn){\n            Roo.MessageBox.alert('Error', 'Please setup the successFn');\n            return;\n        }\n        \n        _this.source = _this.data.successFn(res);\n\n        _this.viewPanel.setContent(_this.source);\n        \n    });\n}"
61                                     },
62                                     "*prop": "sm",
63                                     "singleSelect": true,
64                                     "xtype": "RowSelectionModel",
65                                     "|xns": "Roo.grid"
66                                 },
67                                 {
68                                     "listeners": {
69                                         "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    if(typeof(_this.data) == 'undefined'){\n        this.removeAll();\n        return false;\n    }\n\n    var d = Roo.apply({}, _this.data);\n    delete d.successFn;\n\n    Roo.apply(o.params, d);\n    \n}"
70                                     },
71                                     "*prop": "dataSource",
72                                     "remoteSort": true,
73                                     "xtype": "Store",
74                                     "|sortInfo": "{ field : 'event_when', direction: 'DESC' }",
75                                     "|xns": "Roo.data",
76                                     "items": [
77                                         {
78                                             "*prop": "proxy",
79                                             "method": "GET",
80                                             "xtype": "HttpProxy",
81                                             "|url": "baseURL + '/Roo/Events.php'",
82                                             "|xns": "Roo.data"
83                                         },
84                                         {
85                                             "*prop": "reader",
86                                             "id": "id",
87                                             "root": "data",
88                                             "totalProperty": "total",
89                                             "xtype": "JsonReader",
90                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'event_when',\n        'type': 'string'\n    }\n]",
91                                             "|xns": "Roo.data"
92                                         }
93                                     ]
94                                 },
95                                 {
96                                     "*prop": "footer",
97                                     "displayInfo": false,
98                                     "pageSize": 25,
99                                     "xtype": "PagingToolbar",
100                                     "|xns": "Roo"
101                                 },
102                                 {
103                                     "*prop": "colModel[]",
104                                     "dataIndex": "event_when",
105                                     "header": "Date",
106                                     "width": 100,
107                                     "xtype": "ColumnModel",
108                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }",
109                                     "|xns": "Roo.grid"
110                                 }
111                             ]
112                         }
113                     ]
114                 },
115                 {
116                     "listeners": {
117                         "render": "function (_self)\n{\n    _this.viewPanel = _self;\n}"
118                     },
119                     "autoScroll": true,
120                     "background": false,
121                     "fitContainer": true,
122                     "fitToFrame": true,
123                     "region": "center",
124                     "xtype": "ContentPanel",
125                     "|xns": "Roo"
126                 },
127                 {
128                     "listeners": {
129                         "|click": "function() {\n    _this.dialog.hide();\n}"
130                     },
131                     "*prop": "buttons[]",
132                     "text": "Cancel",
133                     "xtype": "Button",
134                     "|xns": "Roo"
135                 },
136                 {
137                     "listeners": {
138                         "|click": "function() {\n\n    _this.dialog.hide();\n    \n    if (_this.callback && _this.source != '') {\n        _this.callback.call(this, _this.source);\n    }\n}"
139                     },
140                     "*prop": "buttons[]",
141                     "text": "OK",
142                     "xtype": "Button",
143                     "|xns": "Roo"
144                 }
145             ]
146         }
147     ],
148     "permname": "",
149     "modOrder": "001"
150 }