Pman.Dialog.BuilderAddTable.bjs
[Pman.Builder] / Pman.Dialog.BuilderAddTable.bjs
1 {
2     "id": "roo-file-231",
3     "name": "Pman.Dialog.BuilderAddTable",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Builder/Pman.Dialog.BuilderAddTable.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    _this.grid.ds.load({});\n}"
11             },
12             "closable": false,
13             "collapsible": false,
14             "height": 500,
15             "resizable": false,
16             "title": "Select columns to use",
17             "width": 700,
18             "xtype": "LayoutDialog",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "|xns": "Roo",
23                     "xtype": "LayoutRegion",
24                     "*prop": "center"
25                 },
26                 {
27                     "listeners": {
28                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
29                     },
30                     "background": false,
31                     "fitContainer": true,
32                     "fitToframe": true,
33                     "region": "center",
34                     "tableName": "Images",
35                     "title": "Images",
36                     "xtype": "GridPanel",
37                     "|xns": "Roo",
38                     "items": [
39                         {
40                             "listeners": {
41                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.ds.load({});\n    }\n}",
42                                 "cellclick": "function (_self, ri, ci , e)\n{\n   if (ci > 1) {return; }\n   \n    var rec = this.ds.getAt(ri);\n    var di = this.cm.getDataIndex(ci);\n    rec.set(di, (rec.data[di] * 1) ? 0 : 1);\n     rec.commit();\n     \n      \n      \n}"
43                             },
44                             "*prop": "grid",
45                             "autoExpandColumn": "desc",
46                             "loadMask": true,
47                             "xtype": "Grid",
48                             "|xns": "Roo.grid",
49                             "items": [
50                                 {
51                                     "listeners": {
52                                         "beforeload": "function (_self, options)\n{\n    if (typeof(_this.data) == 'undefined') {\n        return false;\n    \n    }\n    options.params = options.params || {};\n    options.params.table = _this.data.table;\n}",
53                                         "load": "function (_self, records, options)\n{\n    // after load, if we have configuration already, overlay that \n    if (typeof(this.data.cols) == 'undefined') {\n        return;\n    }\n       \n        \n        \n        \n}"
54                                     },
55                                     "*prop": "dataSource",
56                                     "remoteSort": true,
57                                     "xtype": "Store",
58                                     "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
59                                     "|xns": "Roo.data",
60                                     "items": [
61                                         {
62                                             "*prop": "proxy",
63                                             "method": "GET",
64                                             "xtype": "HttpProxy",
65                                             "|url": "baseURL + '/Builder/ERM.php'",
66                                             "|xns": "Roo.data"
67                                         },
68                                         {
69                                             "*prop": "reader",
70                                             "id": "id",
71                                             "root": "data",
72                                             "totalProperty": "total",
73                                             "xtype": "JsonReader",
74                                             "|fields": "[\n    { name: 'use', type: 'int'} , \n    { name: 'use_ex', type: 'int'}, \n    'table', 'column', 'ctype', 'desc', 'columnshort'\n]",
75                                             "|xns": "Roo.data"
76                                         }
77                                     ]
78                                 },
79                                 {
80                                     "*prop": "toolbar",
81                                     "xtype": "Toolbar",
82                                     "|xns": "Roo",
83                                     "items": [
84                                         {
85                                             "listeners": {
86                                                 "|click": "function()\n{\n    \n}\n"
87                                             },
88                                             "cls": "x-btn-text-icon",
89                                             "text": "Add",
90                                             "xtype": "Button",
91                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
92                                             "|xns": "Roo.Toolbar"
93                                         },
94                                         {
95                                             "listeners": {
96                                                 "|click": "function()\n{\n    // Pman.genericDelete(_this, 'Images'); \n}\n        "
97                                             },
98                                             "cls": "x-btn-text-icon",
99                                             "text": "Delete",
100                                             "xtype": "Button",
101                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
102                                             "|xns": "Roo.Toolbar"
103                                         }
104                                     ]
105                                 },
106                                 {
107                                     "*prop": "colModel[]",
108                                     "dataIndex": "use",
109                                     "header": "Use",
110                                     "width": 50,
111                                     "xtype": "ColumnModel",
112                                     "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n}",
113                                     "|xns": "Roo.grid"
114                                 },
115                                 {
116                                     "*prop": "colModel[]",
117                                     "dataIndex": "use_ex",
118                                     "header": "Display/Expand",
119                                     "width": 100,
120                                     "xtype": "ColumnModel",
121                                     "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
122                                     "|xns": "Roo.grid"
123                                 },
124                                 {
125                                     "*prop": "colModel[]",
126                                     "dataIndex": "table",
127                                     "header": "Table",
128                                     "width": 100,
129                                     "xtype": "ColumnModel",
130                                     "|renderer": "function(v) { return String.format('{0}', v); }",
131                                     "|xns": "Roo.grid"
132                                 },
133                                 {
134                                     "*prop": "colModel[]",
135                                     "dataIndex": "column",
136                                     "header": "Column",
137                                     "width": 150,
138                                     "xtype": "ColumnModel",
139                                     "|renderer": "function(v,x,r) { \n    if (r.data.table == _this.data.table) {\n    \n        return String.format('{0}', v); \n    }\n    return String.format('.....{0}', r.data.columnshort); \n}",
140                                     "|xns": "Roo.grid"
141                                 },
142                                 {
143                                     "*prop": "colModel[]",
144                                     "dataIndex": "ctype",
145                                     "header": "Type",
146                                     "width": 50,
147                                     "xtype": "ColumnModel",
148                                     "|renderer": "function(v) {\n\n   return v;\n }",
149                                     "|xns": "Roo.grid"
150                                 },
151                                 {
152                                     "*prop": "colModel[]",
153                                     "dataIndex": "desc",
154                                     "header": "Description",
155                                     "width": 200,
156                                     "xtype": "ColumnModel",
157                                     "|renderer": "function(v) { return String.format('{0}', v); }",
158                                     "|xns": "Roo.grid"
159                                 }
160                             ]
161                         }
162                     ]
163                 },
164                 {
165                     "listeners": {
166                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
167                     },
168                     "*prop": "buttons[]",
169                     "text": "Cancel",
170                     "xtype": "Button",
171                     "|xns": "Roo"
172                 },
173                 {
174                     "listeners": {
175                         "click": "function (_self, e)\n{\n     var ret = Roo.apply({ cols : [], cols_ex: [] },  _this.data);\n     \n     _this.grid.ds.each(function(r) {\n     \n        if (r.data.use*1) {\n                ret.cols.push(r.data);\n        }\n         if (r.data.use_ex*1) {\n             ret.cols_ex.push( r.data.column );\n         }\n\n     });\n     \n     if (!ret.cols_ex.length) {\n        Roo.MessageBox.alert(\"Error\", \"Select at least one Display/expand col\");\n        return;\n    }\n     Roo.log(ret);\n     _this.callback(ret);\n     _this.dialog.hide();\n\n}"
176                     },
177                     "*prop": "buttons[]",
178                     "text": "Next",
179                     "xtype": "Button",
180                     "|xns": "Roo"
181                 }
182             ]
183         }
184     ],
185     "permname": "",
186     "modOrder": "001"
187 }