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