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