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 'dc30ec20708ef7b0f641ef78b7880a15' :"DEBUG",
18 '32954654ac8fe66a1d09be19001de2d4' :"Width",
19 'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
20 '6e7376dca68a2386a8737944196ab491' :"Create / Edit Grid"
23 part : ["Editors", "LayoutDialog" ],
24 order : '001-Editor.Roo.LayoutDialog',
27 name : "unnamed module",
39 [ 1, 'test', 'test', 110 ]
43 fields : [ 'active', 'dataIndex', 'type','title', 'width', 'ftype', 'display_field' ],
54 '|xns' : 'Roo.Toolbar',
55 text : _this._strings['2f616612593df62aeed112de4f03110e'],
60 '|xns' : 'Roo.Toolbar',
65 '|xns' : 'Roo.Toolbar',
66 text : _this._strings['dc30ec20708ef7b0f641ef78b7880a15'],
70 click : function (_self, e)
72 Roo.log(_this.ftype_combo);
75 "Field": "manage_scale_id",
81 "relates_to_table": "core_enum",
82 "relates_to_col": "id",
83 "relates_to_schema": {
90 "Extra": "auto_increment"
94 "Type": "varchar(32)",
102 "Type": "varchar(255)",
133 "Field": "display_name",
141 "Field": "is_system_enum",
151 "Field": "person_type",
159 "Field": "employer_name",
167 "Field": "birth_date",
171 "Default": "0000-00-00",
174 "employ_start_date": {
175 "Field": "employ_start_date",
179 "Default": "0000-00-00",
183 "Field": "employ_end_date",
187 "Default": "0000-00-00",
190 "hide_same_employer": {
191 "Field": "hide_same_employer",
199 "Field": "salary_currency",
200 "Type": "varchar(256)",
207 "Field": "quota_currency",
208 "Type": "varchar(256)",
215 "Field": "created_dt",
219 "Default": "0000-00-00 00:00:00",
223 "Field": "updated_dt",
227 "Default": "0000-00-00 00:00:00",
232 Roo.log('debuging...');
233 _this.panel.loadData(data);
242 autoExpandColumn : 'title',
246 xtype : 'EditorGrid',
250 dataIndex : 'active',
251 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
252 renderer : function(v) {
253 var state = v *1 > 0 ? '-checked' : '';
255 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
260 xtype : 'ColumnModel'
264 dataIndex : 'dataIndex',
265 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
266 renderer : function(v) { return String.format('{0}', v); },
269 xtype : 'ColumnModel'
274 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
275 renderer : function(v) { return String.format('{0}', v); },
278 xtype : 'ColumnModel'
289 xtype : 'GridEditor',
297 header : _this._strings['b021df6aac4654c454f46c77646e745f'],
298 renderer : function(v) { return String.format('{0}', v); },
301 xtype : 'ColumnModel',
313 [ 'ComboBox', "ComboBox"],
314 [ 'TextField' , "TextField"],
315 [ 'NumberField', "NumberField"],
316 [ 'TextArea', "TextArea"],
317 [ 'HtmlEditor', "HtmlEditor"],
318 [ 'Hidden', "Hidden"],
319 [ 'DateField', "DateField"],
320 [ 'Checkbox', "Checkbox"]
323 fields : [ 'ftype', 'fname'],
325 xtype : 'SimpleStore'
329 displayField : 'fname',
331 hiddenName : 'status',
335 triggerAction : 'all',
336 valueField : 'ftype',
347 xtype : 'GridEditor',
355 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
356 renderer : function(v) { return String.format('{0}', v); },
359 xtype : 'ColumnModel',
371 [ 'ComboBox', "ComboBox"],
372 [ 'Text' , "TextField"],
373 [ 'Number', "NumberField"],
374 [ 'TextArea', "TextArea"],
375 [ 'Html', "HtmlEntry"]
378 fields : [ 'ftype', 'fname'],
380 xtype : 'SimpleStore'
384 displayField : 'fname',
386 hiddenName : 'status',
389 name : 'display_field',
390 triggerAction : 'all',
391 valueField : 'ftype',
402 xtype : 'GridEditor',
409 dataIndex : 'display_field',
410 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
411 renderer : function(v) { return String.format('{0}', v); },
414 xtype : 'ColumnModel',
424 decimalPrecision : 0,
426 xtype : 'NumberField'
430 xtype : 'GridEditor',
438 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
439 renderer : function(v) { return String.format('{0}', v); },
442 xtype : 'ColumnModel',
450 cellclick : function (_self, rowIndex, columnIndex, e)
453 var di = this.colModel.getDataIndex(columnIndex);
454 if (di != 'active') {
458 var rec = _this.grid.ds.getAt(rowIndex);
460 rec.set('active', rec.data.active * 1 ? 0 : 1);
468 //_this.dialog = Pman.Dialog.FILL_IN
471 rowdblclick : function (_self, rowIndex, e)
473 if (!_this.dialog) return;
486 loadData : function(data) {
488 //alert("IPC:TEST:" + JSON.stringify(data,null,4));
490 var fields = _this.grid.dataSource.reader.recordType.prototype.fields;
493 for (var k in data) {
495 var has_s = typeof(r.relates_to_schema) != 'undefined';
504 display_field : r.Field + '_display_name',
505 relates_to_table : false,
506 relates_to_col : false,
507 relates_to_schema : []
512 for(var j = 0; j = fields.length; j++){
513 var f = fields.items[j];
515 if(o.hasOwnProperty(f.name)){
523 ar.push([ !has_s , r.Field, r.Type, r.Field, 100 , 'TextField', r.Field + '_display_name'] );
528 for (var kk in r.relates_to_schema) {
529 var rr = r.relates_to_schema[kk];
530 if (rr.Field == r.relates_to_col) {
533 ar.push([ false, r.Field + '_'+ rr.Field, rr.Type, rr.Field, 100] );
541 //alert("IPC:TEST:" + JSON.stringify(ar));
542 this.grid.dataSource.loadData(ar);
545 tableName : 'core_enum',
546 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
547 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
550 // convert the selected cells into a BJS data ready to send back to the UI..
553 this.firstTxtCol = "XXX";
558 var formElements = [];
559 this.grid.dataSource.each(function(rec) {
560 if (!rec.data.active) {
565 fieldLabel : rec.data.title,
566 name : rec.data.dataIndex,
567 width : 200, //row.type == 'string' ? 200 : 75,
569 xtype : rec.data.ftype
571 if (xtype == 'DateField') {
577 if (xtype == 'TextArea') {
581 if (xtype == 'Hidden') {
582 delete el.fieldLabel;
585 if (xtype == 'Combobox') {
588 el.queryParam = 'query[' + combofields_name + ']';// SET WHEN USED
590 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
591 el.displayField = combofields_name; // SET WHEN USED eg. project_id
592 el.name = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
593 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
603 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
605 '|beforeload' : 'function (_self, o)' +
607 " o.params = o.params || {};\n" +
608 " // set more here\n" +
614 'xtype' : 'HttpProxy',
617 '|url' : "baseURL + '/Roo/" + reftable + ".php'",
622 'xtype' : 'JsonReader',
626 'totalProperty' : 'total'
637 formElements.push(el);
639 formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
654 "|actioncomplete" : "function(_self,action)\n"+
656 " if (action.type == 'setdata') {\n"+
657 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
660 " if (action.type == 'load') {\n"+
663 " if (action.type =='submit') {\n"+
665 " _this.dialog.hide();\n"+
667 " if (_this.callback) {\n"+
668 " _this.callback.call(_this, action.result.data);\n"+
670 " _this.form.reset();\n"+
675 "|rendered" : "function (form)\n"+
677 " _this.form= form;\n"+
681 style : "margin:10px;",
682 "|url" : "baseURL + '/Roo/" + this.table + "'",
687 alert("IPC:OUT:" + JSON.stringify({
689 "collapsible": false,
690 "height": formHeight,
692 "title": "Edit / Create " + this.table,
695 "xtype": "LayoutDialog",
700 "xtype": "LayoutRegion",
705 "xtype": "ContentPanel",
714 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
716 "*prop": "buttons[]",
723 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
725 "*prop": "buttons[]",
740 activate : function() {
743 _this.grid.footer.onClick('first');