Pman.Dialog.AdminCoreEnum.bjs
[Pman.Admin] / Pman.Dialog.AdminCoreEnum.bjs
1 {
2     "id": "roo-file-180",
3     "name": "Pman.Dialog.AdminCoreEnum",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Admin/Pman.Dialog.AdminCoreEnum.bjs",
7     "items": [
8         {
9             "height": 400,
10             "title": "Pulldown Options",
11             "width": 950,
12             "xtype": "LayoutDialog",
13             "|xns": "Roo",
14             "items": [
15                 {
16                     "|xns": "Roo",
17                     "xtype": "LayoutRegion",
18                     "*prop": "center"
19                 },
20                 {
21                     "listeners": {
22                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n     //   _this.grid.footer.onClick('first');\n    }\n}"
23                     },
24                     "background": false,
25                     "fitContainer": true,
26                     "fitToframe": true,
27                     "region": "center",
28                     "tableName": "core_enum",
29                     "title": "Pulldown Options",
30                     "xtype": "GridPanel",
31                     "|xns": "Roo",
32                     "items": [
33                         {
34                             "listeners": {
35                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n   //    this.footer.onClick('first');\n    }\n}",
36                                 "afteredit": "function (e)\n{\n   e.record.commit();     \n}",
37                                 "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        if (di != 'active') {\n            return;\n        }\n         \n        var rec = _this.grid.ds.getAt(rowIndex);\n        \n        rec.set('active', rec.data.active ? 0 : 1);\n        rec.commit();\n         \n        \n}",
38                                 "beforeedit": "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}"
39                             },
40                             "*prop": "grid",
41                             "autoExpandColumn": "display_name",
42                             "clicksToEdit": 1,
43                             "loadMask": true,
44                             "xtype": "EditorGrid",
45                             "|xns": "Roo.grid",
46                             "items": [
47                                 {
48                                     "listeners": {
49                                         "beforeload": "function (_self, options)\n{\n    if (!_this.etypeCombo) {\n        return false;\n    }\n    options.params.etype = _this.etypeCombo.getValue();\n    if (!options.params.etype.length) {\n        return false;\n    }\n}",
50                                         "update": "function (_self, record, operation)\n{\n    if (operation != Roo.data.Record.COMMIT) {\n        return;\n    }\n    // got commit..\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_enum.php',\n        method : 'POST',\n        params : {\n            id : record.data.id,\n            etype : _this.etypeCombo.getValue(),\n            name : record.data.name,\n            active : record.data.active,\n            seqid : record.data.seqid,\n            display_name : record.data.display_name\n        }, \n        success : function(res) {\n            //Roo.log(data);\n            // update the ID if it's not set..\n            if (record.data.id * 1 < 1) {\n                record.set('id', res.data.id);\n            }\n        }\n    });\n    \n}"
51                                     },
52                                     "*prop": "dataSource",
53                                     "remoteSort": true,
54                                     "xtype": "Store",
55                                     "|sortInfo": "{ field : 'etype', direction: 'ASC' }",
56                                     "|xns": "Roo.data",
57                                     "items": [
58                                         {
59                                             "*prop": "proxy",
60                                             "method": "GET",
61                                             "xtype": "HttpProxy",
62                                             "|url": "baseURL + '/Roo/core_enum.php'",
63                                             "|xns": "Roo.data"
64                                         },
65                                         {
66                                             "|xns": "Roo.data",
67                                             "xtype": "JsonReader",
68                                             "totalProperty": "total",
69                                             "root": "data",
70                                             "*prop": "reader",
71                                             "id": "id",
72                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'etype',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'seqid',\n        'type': 'int'\n    }\n]"
73                                         }
74                                     ]
75                                 },
76                                 {
77                                     "*prop": "footer",
78                                     "xtype": "PagingToolbar",
79                                     "pageSize": 25,
80                                     "displayInfo": true,
81                                     "displayMsg": "Displaying core_enum{0} - {1} of {2}",
82                                     "emptyMsg": "No core_enum found",
83                                     "|xns": "Roo"
84                                 },
85                                 {
86                                     "*prop": "toolbar",
87                                     "xtype": "Toolbar",
88                                     "|xns": "Roo",
89                                     "items": [
90                                         {
91                                             "listeners": {
92                                                 "|click": "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    var et = _this.etypeCombo.getValue();\n    var ds = _this.grid.getDataSource();\n    if (!et) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n        return;\n    }\n\n    var add = ds.reader.newRow({    \n             id: 0, \n             display_name : '', \n             name : '', \n             etype: et, \n             active: 1, \n             seqid: 0\n      });\n     var r = ds.data.length;\n    ds.insert(r  , add);  \n    _this.grid.startEditing(r, 1); // name... \n}\n"
93                                             },
94                                             "cls": "x-btn-text-icon",
95                                             "text": "Add Value",
96                                             "xtype": "Button",
97                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
98                                             "|xns": "Roo.Toolbar"
99                                         },
100                                         {
101                                             "|xns": "Roo.Toolbar",
102                                             "xtype": "Fill"
103                                         }
104                                     ]
105                                 },
106                                 {
107                                     "*prop": "colModel[]",
108                                     "dataIndex": "id",
109                                     "header": "Internal #",
110                                     "width": 75,
111                                     "xtype": "ColumnModel",
112                                     "|renderer": "function(v) { return String.format('{0}', v); }",
113                                     "|xns": "Roo.grid"
114                                 },
115                                 {
116                                     "*prop": "colModel[]",
117                                     "dataIndex": "images_id_id",
118                                     "header": "Image",
119                                     "width": 75,
120                                     "xtype": "ColumnModel",
121                                     "|renderer": "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/25/{1}/{2}\" width=\"25\" height=\"25\">', baseURL, v, r.data.images_id_filename); }",
122                                     "|xns": "Roo.grid"
123                                 },
124                                 {
125                                     "xtype": "ColumnModel",
126                                     "header": "Name",
127                                     "width": 200,
128                                     "dataIndex": "name",
129                                     "|renderer": "function(v) { return String.format('{0}', v); }",
130                                     "|xns": "Roo.grid",
131                                     "*prop": "colModel[]",
132                                     "items": [
133                                         {
134                                             "|xns": "Roo.grid",
135                                             "xtype": "GridEditor",
136                                             "*prop": "editor",
137                                             "items": [
138                                                 {
139                                                     "|xns": "Roo.form",
140                                                     "xtype": "TextField",
141                                                     "*prop": "field"
142                                                 }
143                                             ]
144                                         }
145                                     ]
146                                 },
147                                 {
148                                     "*prop": "colModel[]",
149                                     "dataIndex": "display_name",
150                                     "header": "Display Name",
151                                     "width": 200,
152                                     "xtype": "ColumnModel",
153                                     "|renderer": "function(v) { return String.format('{0}', v); }",
154                                     "|xns": "Roo.grid",
155                                     "items": [
156                                         {
157                                             "|xns": "Roo.grid",
158                                             "xtype": "GridEditor",
159                                             "*prop": "editor",
160                                             "items": [
161                                                 {
162                                                     "|xns": "Roo.form",
163                                                     "xtype": "TextField",
164                                                     "*prop": "field"
165                                                 }
166                                             ]
167                                         }
168                                     ]
169                                 },
170                                 {
171                                     "*prop": "colModel[]",
172                                     "dataIndex": "active",
173                                     "header": "Active",
174                                     "width": 75,
175                                     "xtype": "ColumnModel",
176                                     "|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 }",
177                                     "|xns": "Roo.grid"
178                                 },
179                                 {
180                                     "*prop": "colModel[]",
181                                     "dataIndex": "seqid",
182                                     "header": "Order #",
183                                     "sortable": true,
184                                     "width": 75,
185                                     "xtype": "ColumnModel",
186                                     "|renderer": "function(v) { return String.format('{0}', v); }",
187                                     "|xns": "Roo.grid",
188                                     "items": [
189                                         {
190                                             "|xns": "Roo.grid",
191                                             "xtype": "GridEditor",
192                                             "*prop": "editor",
193                                             "items": [
194                                                 {
195                                                     "*prop": "field",
196                                                     "allowDecimals": false,
197                                                     "allowNegative": true,
198                                                     "decimalPrecision": 0,
199                                                     "xtype": "NumberField",
200                                                     "|xns": "Roo.form"
201                                                 }
202                                             ]
203                                         }
204                                     ]
205                                 }
206                             ]
207                         }
208                     ]
209                 },
210                 {
211                     "*prop": "buttons[]",
212                     "text": "OK",
213                     "xtype": "Button",
214                     "|xns": "Roo"
215                 }
216             ]
217         }
218     ],
219     "permname": "",
220     "modOrder": "001"
221 }