1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Editor.Roo');
7 Editor.Roo.LayoutDialog = new Roo.XComponent({
10 'b021df6aac4654c454f46c77646e745f' :"Label",
11 '793548e77e782c209a78ed67f255b5e2' :"Display Field",
12 '4ce58cbe362a5d7b156992a496d55bf3' :"Database Column",
13 '189efd19c4153526994a6d7ea5f6f068' :"Field Type",
14 '2f616612593df62aeed112de4f03110e' :"Edit a Grid",
15 '0ccc2bf3fb98387c23b6ca5500244d6e' :"Use ",
16 'c671c787b49f50a3ace9fdc5bd597825' :"core_enum",
17 '32954654ac8fe66a1d09be19001de2d4' :"Width",
18 'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
19 '6e7376dca68a2386a8737944196ab491' :"Create / Edit Grid"
22 part : ["Editors", "LayoutDialog" ],
23 order : '001-Editor.Roo.LayoutDialog',
26 name : "unnamed module",
38 [ 1, 'test', 'test', 110 ]
42 fields : [ 'active', 'dataIndex', 'type','title', 'width', 'ftype', 'display_field' ],
53 '|xns' : 'Roo.Toolbar',
54 text : _this._strings['2f616612593df62aeed112de4f03110e'],
62 autoExpandColumn : 'title',
71 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
72 renderer : function(v) {
73 var state = v *1 > 0 ? '-checked' : '';
75 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
84 dataIndex : 'dataIndex',
85 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
86 renderer : function(v) { return String.format('{0}', v); },
94 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
95 renderer : function(v) { return String.format('{0}', v); },
109 xtype : 'GridEditor',
117 header : _this._strings['b021df6aac4654c454f46c77646e745f'],
118 renderer : function(v) { return String.format('{0}', v); },
121 xtype : 'ColumnModel',
133 [ 'ComboBox', "ComboBox"],
134 [ 'TextField' , "TextField"],
135 [ 'NumberField', "NumberField"],
136 [ 'TextArea', "TextArea"],
137 [ 'HtmlEditor', "HtmlEditor"],
138 [ 'Hidden', "Hidden"],
139 [ 'DateField', "DateField"] ,
140 [ 'Checkbox', "Checkbox"]
143 fields : [ 'ftype', 'fname'],
145 xtype : 'SimpleStore'
149 displayField : 'fname',
151 hiddenName : 'status',
155 triggerAction : 'all',
156 valueField : 'ftype',
167 xtype : 'GridEditor',
175 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
176 renderer : function(v) { return String.format('{0}', v); },
179 xtype : 'ColumnModel',
191 [ 'ComboBox', "ComboBox"],
192 [ 'Text' , "TextField"],
193 [ 'Number', "NumberField"],
194 [ 'TextArea', "TextArea"],
195 [ 'Html', "HtmlEntry"]
198 fields : [ 'ftype', 'fname'],
200 xtype : 'SimpleStore'
204 displayField : 'fname',
206 hiddenName : 'status',
210 triggerAction : 'all',
211 valueField : 'ftype',
222 xtype : 'GridEditor',
229 dataIndex : 'display_field',
230 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
231 renderer : function(v) { return String.format('{0}', v); },
234 xtype : 'ColumnModel',
244 decimalPrecision : 0,
246 xtype : 'NumberField'
250 xtype : 'GridEditor',
258 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
259 renderer : function(v) { return String.format('{0}', v); },
262 xtype : 'ColumnModel',
270 cellclick : function (_self, rowIndex, columnIndex, e)
273 var di = this.colModel.getDataIndex(columnIndex);
274 if (di != 'active') {
278 var rec = _this.grid.ds.getAt(rowIndex);
280 rec.set('active', rec.data.active * 1 ? 0 : 1);
288 //_this.dialog = Pman.Dialog.FILL_IN
291 rowdblclick : function (_self, rowIndex, e)
293 if (!_this.dialog) return;
306 loadData : function(data) {
308 //alert("IPC:TEST:" + JSON.stringify(data,null,4));
309 alert("IPC:TEST:" + JSON.stringify({ x: 5, y: 6 },null,4));
313 for (var k in data) {
315 var has_s = typeof(r.relates_to_schema) != 'undefined'
316 ar.push([ !has_s , r.Field, r.Type, r.Field, 100 , 'TextField', r.Field + '_display_name'] );
321 for (var kk in r.relates_to_schema) {
322 var rr = r.relates_to_schema[kk];
323 if (rr.Field == r.relates_to_col) {
326 ar.push([ false, r.Field + '_'+ rr.Field, rr.Type, rr.Field, 100] );
331 //alert("IPC:TEST:" + JSON.stringify(ar));
332 this.grid.dataSource.loadData(ar);
335 tableName : 'core_enum',
336 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
337 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
340 // convert the selected cells into a BJS data ready to send back to the UI..
343 this.firstTxtCol = "XXX";
348 var formElements = [];
349 this.grid.dataSource.each(function(rec) {
350 if (!rec.data.active) {
355 fieldLabel : rec.data.title,
356 name : rec.data.dataIndex,
357 width : 200, //row.type == 'string' ? 200 : 75,
359 xtype : rec.data.ftype
361 if (xtype == 'DateField') {
367 if (xtype == 'TextArea') {
371 if (xtype == 'Hidden') {
372 delete el.fieldLabel;
375 if (xtype == 'Combobox') {
378 el.queryParam = 'query[' + combofields_name + ']';// SET WHEN USED
380 el.hiddenName = old.name; // SET WHEN USED eg. project_id
381 el.displayField = combofields_name; // SET WHEN USED eg. project_id
382 el.name = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
383 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
393 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
395 '|beforeload' : 'function (_self, o)' +
397 " o.params = o.params || {};\n" +
398 " // set more here\n" +
404 'xtype' : 'HttpProxy',
407 '|url' : "baseURL + '/Roo/" + reftable + ".php'",
412 'xtype' : 'JsonReader',
416 'totalProperty' : 'total'
427 formElements.push(el);
429 formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
444 "|actioncomplete" : "function(_self,action)\n"+
446 " if (action.type == 'setdata') {\n"+
447 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
450 " if (action.type == 'load') {\n"+
453 " if (action.type =='submit') {\n"+
455 " _this.dialog.hide();\n"+
457 " if (_this.callback) {\n"+
458 " _this.callback.call(_this, action.result.data);\n"+
460 " _this.form.reset();\n"+
465 "|rendered" : "function (form)\n"+
467 " _this.form= form;\n"+
471 style : "margin:10px;",
472 "|url" : "baseURL + '/Roo/" + this.table + "'",
477 alert("IPC:OUT:" + JSON.stringify({
479 "collapsible": false,
480 "height": formHeight,
482 "title": "Edit / Create " + this.table,
485 "xtype": "LayoutDialog",
490 "xtype": "LayoutRegion",
495 "xtype": "ContentPanel",
504 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
506 "*prop": "buttons[]",
513 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
515 "*prop": "buttons[]",
530 activate : function() {
533 _this.grid.footer.onClick('first');