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 '040076bde7f6b3387448e32b66c2eee0' :"To BJS",
13 '4ce58cbe362a5d7b156992a496d55bf3' :"Database Column",
14 '189efd19c4153526994a6d7ea5f6f068' :"Field Type",
15 '2f616612593df62aeed112de4f03110e' :"Edit a Grid",
16 '0ccc2bf3fb98387c23b6ca5500244d6e' :"Use ",
17 'c671c787b49f50a3ace9fdc5bd597825' :"core_enum",
18 '32954654ac8fe66a1d09be19001de2d4' :"Width",
19 'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
20 '6e7376dca68a2386a8737944196ab491' :"Create / Edit Grid",
21 'f541774a08fc687f6e2016c77a6ebca5' :"Load Data"
24 part : ["Editors", "LayoutDialog" ],
25 order : '001-Editor.Roo.LayoutDialog',
28 name : "unnamed module",
40 [ 1, 'test', 'test', 110 ]
66 '|xns' : 'Roo.Toolbar',
67 text : _this._strings['2f616612593df62aeed112de4f03110e'],
72 '|xns' : 'Roo.Toolbar',
77 '|xns' : 'Roo.Toolbar',
78 text : _this._strings['f541774a08fc687f6e2016c77a6ebca5'],
82 click : function (_self, e)
86 "Field": "manage_scale_id",
92 "relates_to_table": "core_enum",
93 "relates_to_col": "id",
94 "relates_to_schema": {
101 "Extra": "auto_increment"
105 "Type": "varchar(32)",
113 "Type": "varchar(255)",
144 "Field": "display_name",
152 "Field": "is_system_enum",
162 "Field": "person_type",
170 "Field": "employer_name",
178 "Field": "birth_date",
182 "Default": "0000-00-00",
185 "employ_start_date": {
186 "Field": "employ_start_date",
190 "Default": "0000-00-00",
194 "Field": "employ_end_date",
198 "Default": "0000-00-00",
201 "hide_same_employer": {
202 "Field": "hide_same_employer",
210 "Field": "salary_currency",
211 "Type": "varchar(256)",
218 "Field": "quota_currency",
219 "Type": "varchar(256)",
226 "Field": "created_dt",
230 "Default": "0000-00-00 00:00:00",
234 "Field": "updated_dt",
238 "Default": "0000-00-00 00:00:00",
243 Roo.log('Loading Data...');
244 _this.panel.loadData(data);
250 '|xns' : 'Roo.Toolbar',
255 '|xns' : 'Roo.Toolbar',
256 text : _this._strings['040076bde7f6b3387448e32b66c2eee0'],
260 click : function (_self, e)
263 Roo.log('Converting to BJS...');
273 autoExpandColumn : 'title',
277 xtype : 'EditorGrid',
281 dataIndex : 'active',
282 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
283 renderer : function(v) {
284 var state = v *1 > 0 ? '-checked' : '';
286 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
291 xtype : 'ColumnModel'
295 dataIndex : 'dataIndex',
296 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
297 renderer : function(v) { return String.format('{0}', v); },
300 xtype : 'ColumnModel'
305 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
306 renderer : function(v) { return String.format('{0}', v); },
309 xtype : 'ColumnModel'
320 xtype : 'GridEditor',
328 header : _this._strings['b021df6aac4654c454f46c77646e745f'],
329 renderer : function(v) { return String.format('{0}', v); },
332 xtype : 'ColumnModel',
344 [ 'ComboBox', "ComboBox"],
345 [ 'TextField' , "TextField"],
346 [ 'NumberField', "NumberField"],
347 [ 'TextArea', "TextArea"],
348 [ 'HtmlEditor', "HtmlEditor"],
349 [ 'Hidden', "Hidden"],
350 [ 'DateField', "DateField"],
351 [ 'Checkbox', "Checkbox"]
354 fields : [ 'ftype', 'fname'],
356 xtype : 'SimpleStore'
360 displayField : 'fname',
362 hiddenName : 'status',
366 triggerAction : 'all',
367 valueField : 'ftype',
378 xtype : 'GridEditor',
386 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
387 renderer : function(v) { return String.format('{0}', v); },
390 xtype : 'ColumnModel',
404 fields : [ 'dfield'],
406 xtype : 'SimpleStore'
410 displayField : 'dfield',
412 hiddenName : 'status',
415 name : 'display_field',
416 triggerAction : 'all',
417 valueField : 'dfield',
428 xtype : 'GridEditor',
435 dataIndex : 'display_field',
436 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
437 renderer : function(v) { return String.format('{0}', v); },
440 xtype : 'ColumnModel',
450 decimalPrecision : 0,
452 xtype : 'NumberField'
456 xtype : 'GridEditor',
464 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
465 renderer : function(v) { return String.format('{0}', v); },
468 xtype : 'ColumnModel',
476 beforeedit : function (e)
478 Roo.log('before edit!!!');
481 if(e.field != 'display_field'){
485 _this.grid.colModel.getCellEditor(e.column, e.row).field.store.loadData(e.record.data.relates_to_schema);
487 cellclick : function (_self, rowIndex, columnIndex, e)
490 var di = this.colModel.getDataIndex(columnIndex);
491 if (di != 'active') {
495 var rec = _this.grid.ds.getAt(rowIndex);
497 rec.set('active', rec.data.active * 1 ? 0 : 1);
505 //_this.dialog = Pman.Dialog.FILL_IN
508 rowdblclick : function (_self, rowIndex, e)
510 if (!_this.dialog) return;
523 loadData : function(data) {
525 //alert("IPC:TEST:" + JSON.stringify(data,null,4));
527 var fields = _this.grid.dataSource.reader.recordType.prototype.fields;
532 for (var k in data) {
534 var has_s = typeof(r.relates_to_schema) != 'undefined';
536 var rt = '', rc = '', rs = [];
539 for (var kk in r.relates_to_schema) {
540 var rr = r.relates_to_schema[kk];
542 rt = r.relates_to_table;
543 rc = r.relates_to_col;
557 display_field : rc, //r.Field + '_display_name',
558 relates_to_table : rt,
560 relates_to_schema : rs
569 for (var kk in r.relates_to_schema) {
570 var rr = r.relates_to_schema[kk];
571 if (rr.Field == r.relates_to_col) {
577 dataIndex : r.Field + '_'+ rr.Field,
589 Roo.each(d, function(dd){
593 for(var j = 0; j < fields.length; j++){
594 var f = fields.items[j];
596 if(dd.hasOwnProperty(f.name)){
606 //alert("IPC:TEST:" + JSON.stringify(ar));
607 this.grid.dataSource.loadData(ar);
610 tableName : 'core_enum',
611 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
612 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
615 // convert the selected cells into a BJS data ready to send back to the UI..
618 this.firstTxtCol = "XXX";
623 var formElements = [];
624 this.grid.dataSource.each(function(rec) {
625 if (!rec.data.active) {
630 fieldLabel : rec.data.title,
631 name : rec.data.dataIndex,
632 width : rec.data.width,
634 xtype : rec.data.ftype
636 if (el.xtype == 'DateField') {
642 if (el.xtype == 'TextArea') {
646 if (el.xtype == 'Hidden') {
647 delete el.fieldLabel;
650 if (el.xtype == 'Combobox') {
653 el.queryParam = 'query[' + rec.data.display_field + ']';// SET WHEN USED
655 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
656 el.name = rec.data.dataIndex + '_' + rec.data.display_field; // SET WHEN USED eg. project_id_name
658 el.displayField = rec.data.display_field // SET WHEN USED eg. project_id
659 el.valueField = rec.data.relates_to_col
661 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + rec.data.display_field +'}</b> </div>'; // SET WHEN USED
671 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
673 '|beforeload' : 'function (_self, o)' +
675 " o.params = o.params || {};\n" +
676 " // set more here\n" +
682 'xtype' : 'HttpProxy',
685 '|url' : "baseURL + '/Roo/" + rec.data.relates_to_table + ".php'",
690 'xtype' : 'JsonReader',
694 'totalProperty' : 'total'
704 if (el.xtype == 'HtmlEditor') {
709 '|xns' : 'Roo.form.HtmlEditor',
710 'xtype' : 'ToolbarContext'
713 '|xns' : 'Roo.form.HtmlEditor',
714 'xtype' : 'ToolbarStandard'
720 formElements.push(el);
722 formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
737 "|actioncomplete" : "function(_self,action)\n"+
739 " if (action.type == 'setdata') {\n"+
740 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
743 " if (action.type == 'load') {\n"+
746 " if (action.type =='submit') {\n"+
748 " _this.dialog.hide();\n"+
750 " if (_this.callback) {\n"+
751 " _this.callback.call(_this, action.result.data);\n"+
753 " _this.form.reset();\n"+
758 "|rendered" : "function (form)\n"+
760 " _this.form= form;\n"+
764 style : "margin:10px;",
765 "|url" : "baseURL + '/Roo/" + this.table + "'",
770 alert("IPC:OUT:" + JSON.stringify({
772 "collapsible": false,
773 "height": formHeight,
775 "title": "Edit / Create " + this.table,
778 "xtype": "LayoutDialog",
783 "xtype": "LayoutRegion",
788 "xtype": "ContentPanel",
797 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
799 "*prop": "buttons[]",
806 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
808 "*prop": "buttons[]",
823 activate : function() {
826 _this.grid.footer.onClick('first');