1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
7 // register the module first
8 Pman.on('beforeload', function()
11 modKey : '500-Pman.Tab.AdminEnums',
12 module : Pman.Tab.AdminEnums,
14 parent : Pman.Tab.Admin,
15 name : "Pman.Tab.AdminEnums",
21 Pman.Tab.AdminEnums = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
37 activate : function() {
40 _this.grid.footer.onClick('first');
48 tableName : 'core_enum',
49 title : "Enum options",
57 //_this.dialog = Pman.Dialog.FILL_IN
58 if (_this.panel.active) {
59 this.footer.onClick('first');
62 afteredit : function (e)
66 cellclick : function (_self, rowIndex, columnIndex, e)
69 var di = this.colModel.getDataIndex(columnIndex);
74 var rec = _this.grid.ds.getAt(rowIndex);
76 rec.set('active', rec.data.active ? 0 : 1);
82 autoExpandColumn : 'name',
89 beforeload : function (_self, options)
91 if (!_this.etypeCombo) {
94 options.params.etype = _this.etypeCombo.getValue();
95 if (!options.params.etype.length) {
99 update : function (_self, record, operation)
101 if (operation != Roo.data.Record.COMMIT) {
106 url : baseURL + '/Roo/Core_enum.php',
110 etype : _this.etypeCombo.getValue(),
111 name : record.data.name,
112 active : record.data.active,
113 seqid : record.data.seqid
115 success : function(res) {
117 // update the ID if it's not set..
118 if (record.data.id * 1 < 1) {
119 record.set('id', res.data.id);
127 sortInfo : { field : 'etype', direction: 'ASC' },
132 url : baseURL + '/Roo/core_enum.php'
137 totalProperty : 'total',
165 xtype: 'PagingToolbar',
169 displayMsg : 'Displaying core_enum{0} - {1} of {2}',
170 emptyMsg : 'No core_enum found'
185 render : function (_self)
187 _this.etypeCombo = _self;
189 select : function (combo, record, index)
191 _this.grid.footer.onClick('first');
195 displayField : 'name',
197 emptyText : "Select type",
198 fieldLabel : 'core_enum',
199 forceSelection : true,
201 loadingText : "Searching...",
204 qtip : "Select type",
205 queryParam : 'query[name]',
206 selectOnFocus : true,
207 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
208 triggerAction : 'all',
216 beforeload : function (_self, o){
217 o.params = o.params || {};
219 o.params['query[empty_etype]'] = 1;
223 sortInfo : { direction : 'ASC', field: 'id' },
228 url : baseURL + '/Roo/core_enum.php'
235 totalProperty : 'total',
236 fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
247 // if we do not have a selected type... - what should we show..?
248 var et = _this.etypeCombo.getValue()
249 var ds = _this.grid.getDataSource();
251 var add = ds.reader.newRow({ id: 0, name : '', etype: et, active: 0, seqid: 0 });
252 var r = ds.data.length;
254 _this.grid.startEditing(r, 1); // name...
257 cls : 'x-btn-text-icon',
259 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
272 Roo.MessageBox.prompt ("Create a new Enum type",
273 "Enter the name for a new enum type, " +
274 "this is only relivant if you know how it is going to be used",
280 url : baseURL + '/Roo/Core_enum.php',
287 success : function() {
288 Roo.MessageBox.alert("Created", "You can now select it from the type list on the left");
302 cls : 'x-btn-text-icon',
303 text : "Add new type",
304 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
310 xtype: 'ColumnModel',
315 renderer : function(v) { return String.format('{0}', v); }
318 xtype: 'ColumnModel',
323 renderer : function(v) { return String.format('{0}', v); },
334 xtype: 'ColumnModel',
336 dataIndex : 'active',
339 renderer : function(v) {
340 var state = v> 0 ? '-checked' : '';
342 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
347 xtype: 'ColumnModel',
352 renderer : function(v) { return String.format('{0}', v); },
358 xtype: 'NumberField',
360 allowDecimals : false,
361 allowNegative : true,
369 this.layout = this.panel.layout;