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)
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',
341 render : function (_self)
343 Roo.log('ftype combo render');
344 _this.ftype_combo = _self;
354 xtype : 'GridEditor',
362 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
363 renderer : function(v) { return String.format('{0}', v); },
366 xtype : 'ColumnModel',
378 [ 'ComboBox', "ComboBox"],
379 [ 'Text' , "TextField"],
380 [ 'Number', "NumberField"],
381 [ 'TextArea', "TextArea"],
382 [ 'Html', "HtmlEntry"]
385 fields : [ 'ftype', 'fname'],
387 xtype : 'SimpleStore'
391 displayField : 'fname',
393 hiddenName : 'status',
396 name : 'display_field',
397 triggerAction : 'all',
398 valueField : 'ftype',
403 render : function (_self)
405 _this.display_field_combo = _self;
415 xtype : 'GridEditor',
422 dataIndex : 'display_field',
423 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
424 renderer : function(v) { return String.format('{0}', v); },
427 xtype : 'ColumnModel',
437 decimalPrecision : 0,
439 xtype : 'NumberField'
443 xtype : 'GridEditor',
451 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
452 renderer : function(v) { return String.format('{0}', v); },
455 xtype : 'ColumnModel',
463 cellclick : function (_self, rowIndex, columnIndex, e)
466 var di = this.colModel.getDataIndex(columnIndex);
467 if (di != 'active') {
471 var rec = _this.grid.ds.getAt(rowIndex);
473 rec.set('active', rec.data.active * 1 ? 0 : 1);
481 //_this.dialog = Pman.Dialog.FILL_IN
484 rowdblclick : function (_self, rowIndex, e)
486 if (!_this.dialog) return;
499 loadData : function(data) {
501 //alert("IPC:TEST:" + JSON.stringify(data,null,4));
504 for (var k in data) {
506 var has_s = typeof(r.relates_to_schema) != 'undefined'
507 ar.push([ !has_s , r.Field, r.Type, r.Field, 100 , 'TextField', r.Field + '_display_name'] );
512 for (var kk in r.relates_to_schema) {
513 var rr = r.relates_to_schema[kk];
514 if (rr.Field == r.relates_to_col) {
517 ar.push([ false, r.Field + '_'+ rr.Field, rr.Type, rr.Field, 100] );
523 //alert("IPC:TEST:" + JSON.stringify(ar));
524 this.grid.dataSource.loadData(ar);
527 tableName : 'core_enum',
528 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
529 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
532 // convert the selected cells into a BJS data ready to send back to the UI..
535 this.firstTxtCol = "XXX";
540 var formElements = [];
541 this.grid.dataSource.each(function(rec) {
542 if (!rec.data.active) {
547 fieldLabel : rec.data.title,
548 name : rec.data.dataIndex,
549 width : 200, //row.type == 'string' ? 200 : 75,
551 xtype : rec.data.ftype
553 if (xtype == 'DateField') {
559 if (xtype == 'TextArea') {
563 if (xtype == 'Hidden') {
564 delete el.fieldLabel;
567 if (xtype == 'Combobox') {
570 el.queryParam = 'query[' + combofields_name + ']';// SET WHEN USED
572 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
573 el.displayField = combofields_name; // SET WHEN USED eg. project_id
574 el.name = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
575 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
585 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
587 '|beforeload' : 'function (_self, o)' +
589 " o.params = o.params || {};\n" +
590 " // set more here\n" +
596 'xtype' : 'HttpProxy',
599 '|url' : "baseURL + '/Roo/" + reftable + ".php'",
604 'xtype' : 'JsonReader',
608 'totalProperty' : 'total'
619 formElements.push(el);
621 formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
636 "|actioncomplete" : "function(_self,action)\n"+
638 " if (action.type == 'setdata') {\n"+
639 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
642 " if (action.type == 'load') {\n"+
645 " if (action.type =='submit') {\n"+
647 " _this.dialog.hide();\n"+
649 " if (_this.callback) {\n"+
650 " _this.callback.call(_this, action.result.data);\n"+
652 " _this.form.reset();\n"+
657 "|rendered" : "function (form)\n"+
659 " _this.form= form;\n"+
663 style : "margin:10px;",
664 "|url" : "baseURL + '/Roo/" + this.table + "'",
669 alert("IPC:OUT:" + JSON.stringify({
671 "collapsible": false,
672 "height": formHeight,
674 "title": "Edit / Create " + this.table,
677 "xtype": "LayoutDialog",
682 "xtype": "LayoutRegion",
687 "xtype": "ContentPanel",
696 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
698 "*prop": "buttons[]",
705 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
707 "*prop": "buttons[]",
722 activate : function() {
725 _this.grid.footer.onClick('first');