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