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             "modal": true,
16             "resizable": false,
17             "title": "Select columns to use",
18             "width": 700,
19             "xtype": "LayoutDialog",
20             "|xns": "Roo",
21             "items": [
22                 {
23                     "|xns": "Roo",
24                     "xtype": "LayoutRegion",
25                     "*prop": "center"
26                 },
27                 {
28                     "listeners": {
29                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
30                     },
31                     "background": false,
32                     "fitContainer": true,
33                     "fitToframe": true,
34                     "region": "center",
35                     "tableName": "Images",
36                     "title": "Images",
37                     "xtype": "GridPanel",
38                     "|xns": "Roo",
39                     "items": [
40                         {
41                             "listeners": {
42                                 "|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}",
43                                 "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}"
44                             },
45                             "*prop": "grid",
46                             "autoExpandColumn": "desc",
47                             "loadMask": true,
48                             "xtype": "Grid",
49                             "|xns": "Roo.grid",
50                             "items": [
51                                 {
52                                     "listeners": {
53                                         "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}",
54                                         "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    _this.data.cols_ex = _this.data.cols_ex || [];\n    var cmap = {}\n    Roo.each(_this.data.cols, function (col) {\n        cmap[col.column] = col;\n    \n    });\n    Roo.each(records, function (col) {\n        col.set('use_ex', _this.data.cols_ex.indexOf(col.data.column) > -1 ? 1 : 0);\n        if (typeof(cmap[col.data.column]) == 'undefined') {\n            return;\n        }\n        col.set('use', 1);\n\n        // what about descption..\n    });\n      \n        \n        \n}"
55                                     },
56                                     "*prop": "dataSource",
57                                     "remoteSort": true,
58                                     "xtype": "Store",
59                                     "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
60                                     "|xns": "Roo.data",
61                                     "items": [
62                                         {
63                                             "*prop": "proxy",
64                                             "method": "GET",
65                                             "xtype": "HttpProxy",
66                                             "|url": "baseURL + '/Builder/ERM.php'",
67                                             "|xns": "Roo.data"
68                                         },
69                                         {
70                                             "*prop": "reader",
71                                             "id": "id",
72                                             "root": "data",
73                                             "totalProperty": "total",
74                                             "xtype": "JsonReader",
75                                             "|fields": "[\n    { name: 'use', type: 'int'} , \n    { name: 'use_ex', type: 'int'}, \n    'table', 'column', 'ctype', 'desc', 'columnshort'\n]",
76                                             "|xns": "Roo.data"
77                                         }
78                                     ]
79                                 },
80                                 {
81                                     "*prop": "toolbar",
82                                     "xtype": "Toolbar",
83                                     "|xns": "Roo",
84                                     "items": [
85                                         {
86                                             "listeners": {
87                                                 "|click": "function()\n{\n    \n}\n"
88                                             },
89                                             "cls": "x-btn-text-icon",
90                                             "text": "Add",
91                                             "xtype": "Button",
92                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
93                                             "|xns": "Roo.Toolbar"
94                                         },
95                                         {
96                                             "listeners": {
97                                                 "|click": "function()\n{\n    // Pman.genericDelete(_this, 'Images'); \n}\n        "
98                                             },
99                                             "cls": "x-btn-text-icon",
100                                             "text": "Delete",
101                                             "xtype": "Button",
102                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
103                                             "|xns": "Roo.Toolbar"
104                                         }
105                                     ]
106                                 },
107                                 {
108                                     "*prop": "colModel[]",
109                                     "dataIndex": "use",
110                                     "header": "Use",
111                                     "width": 50,
112                                     "xtype": "ColumnModel",
113                                     "|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}",
114                                     "|xns": "Roo.grid"
115                                 },
116                                 {
117                                     "*prop": "colModel[]",
118                                     "dataIndex": "use_ex",
119                                     "header": "Display/Expand",
120                                     "width": 100,
121                                     "xtype": "ColumnModel",
122                                     "|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 }",
123                                     "|xns": "Roo.grid"
124                                 },
125                                 {
126                                     "*prop": "colModel[]",
127                                     "dataIndex": "table",
128                                     "header": "Table",
129                                     "width": 100,
130                                     "xtype": "ColumnModel",
131                                     "|renderer": "function(v) { \n\n    return String.format('{0}', v == _this.data.table ? '' : ('...' + v));\n    \n }",
132                                     "|xns": "Roo.grid"
133                                 },
134                                 {
135                                     "*prop": "colModel[]",
136                                     "dataIndex": "column",
137                                     "header": "Column",
138                                     "width": 150,
139                                     "xtype": "ColumnModel",
140                                     "|renderer": "function(v,x,r) { \n    if (r.data.table == _this.data.table) {\n    \n        return String.format('<B>{0}</B>', v); \n    }\n    return String.format('.....{0}', r.data.columnshort); \n}",
141                                     "|xns": "Roo.grid"
142                                 },
143                                 {
144                                     "*prop": "colModel[]",
145                                     "dataIndex": "ctype",
146                                     "header": "Type",
147                                     "width": 50,
148                                     "xtype": "ColumnModel",
149                                     "|renderer": "function(v) {\n\n   return v;\n }",
150                                     "|xns": "Roo.grid"
151                                 },
152                                 {
153                                     "*prop": "colModel[]",
154                                     "dataIndex": "desc",
155                                     "header": "Description",
156                                     "width": 200,
157                                     "xtype": "ColumnModel",
158                                     "|renderer": "function(v) { return String.format('{0}', v); }",
159                                     "|xns": "Roo.grid"
160                                 }
161                             ]
162                         }
163                     ]
164                 },
165                 {
166                     "listeners": {
167                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
168                     },
169                     "*prop": "buttons[]",
170                     "text": "Cancel",
171                     "xtype": "Button",
172                     "|xns": "Roo"
173                 },
174                 {
175                     "listeners": {
176                         "click": "function (_self, e)\n{\n     var ret = Roo.applyIf({ 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.json);\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}"
177                     },
178                     "*prop": "buttons[]",
179                     "text": "Next",
180                     "xtype": "Button",
181                     "|xns": "Roo"
182                 }
183             ]
184         }
185     ],
186     "permname": "",
187     "modOrder": "001"
188 }