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 ]
65 '|xns' : 'Roo.Toolbar',
66 text : _this._strings['2f616612593df62aeed112de4f03110e'],
71 '|xns' : 'Roo.Toolbar',
76 '|xns' : 'Roo.Toolbar',
77 text : _this._strings['dc30ec20708ef7b0f641ef78b7880a15'],
81 click : function (_self, e)
83 Roo.log(_this.ftype_combo);
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('debuging...');
244 _this.panel.loadData(data);
253 autoExpandColumn : 'title',
257 xtype : 'EditorGrid',
261 dataIndex : 'active',
262 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
263 renderer : function(v) {
264 var state = v *1 > 0 ? '-checked' : '';
266 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
271 xtype : 'ColumnModel'
275 dataIndex : 'dataIndex',
276 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
277 renderer : function(v) { return String.format('{0}', v); },
280 xtype : 'ColumnModel'
285 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
286 renderer : function(v) { return String.format('{0}', v); },
289 xtype : 'ColumnModel'
300 xtype : 'GridEditor',
308 header : _this._strings['b021df6aac4654c454f46c77646e745f'],
309 renderer : function(v) { return String.format('{0}', v); },
312 xtype : 'ColumnModel',
324 [ 'ComboBox', "ComboBox"],
325 [ 'TextField' , "TextField"],
326 [ 'NumberField', "NumberField"],
327 [ 'TextArea', "TextArea"],
328 [ 'HtmlEditor', "HtmlEditor"],
329 [ 'Hidden', "Hidden"],
330 [ 'DateField', "DateField"],
331 [ 'Checkbox', "Checkbox"]
334 fields : [ 'ftype', 'fname'],
336 xtype : 'SimpleStore'
340 displayField : 'fname',
342 hiddenName : 'status',
346 triggerAction : 'all',
347 valueField : 'ftype',
358 xtype : 'GridEditor',
366 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
367 renderer : function(v) { return String.format('{0}', v); },
370 xtype : 'ColumnModel',
386 xtype : 'SimpleStore'
390 displayField : 'fname',
392 hiddenName : 'status',
395 name : 'display_field',
396 triggerAction : 'all',
397 valueField : 'ftype',
408 xtype : 'GridEditor',
415 dataIndex : 'display_field',
416 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
417 renderer : function(v) { return String.format('{0}', v); },
420 xtype : 'ColumnModel',
430 decimalPrecision : 0,
432 xtype : 'NumberField'
436 xtype : 'GridEditor',
444 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
445 renderer : function(v) { return String.format('{0}', v); },
448 xtype : 'ColumnModel',
456 beforeedit : function (e)
458 Roo.log('before edit!!!');
461 _this.grid.colModel.getCellEditor(e.column, e.row).field.store.loadData(e.record.data.relates_to_schema);
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));
503 var fields = _this.grid.dataSource.reader.recordType.prototype.fields;
508 for (var k in data) {
510 var has_s = typeof(r.relates_to_schema) != 'undefined';
512 var rt = '', rc = '', rs = [];
515 for (var kk in r.relates_to_schema) {
516 var rr = r.relates_to_schema[kk];
518 rt = r.relates_to_table;
519 rc = r.relates_to_col;
533 display_field : r.Field + '_display_name',
534 relates_to_table : rt,
536 relates_to_schema : rs
545 for (var kk in r.relates_to_schema) {
546 var rr = r.relates_to_schema[kk];
547 if (rr.Field == r.relates_to_col) {
553 dataIndex : r.Field + '_'+ rr.Field,
565 Roo.each(d, function(dd){
569 for(var j = 0; j < fields.length; j++){
570 var f = fields.items[j];
572 if(dd.hasOwnProperty(f.name)){
584 //alert("IPC:TEST:" + JSON.stringify(ar));
585 this.grid.dataSource.loadData(ar);
588 tableName : 'core_enum',
589 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
590 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
593 // convert the selected cells into a BJS data ready to send back to the UI..
596 this.firstTxtCol = "XXX";
601 var formElements = [];
602 this.grid.dataSource.each(function(rec) {
603 if (!rec.data.active) {
608 fieldLabel : rec.data.title,
609 name : rec.data.dataIndex,
610 width : 200, //row.type == 'string' ? 200 : 75,
612 xtype : rec.data.ftype
614 if (xtype == 'DateField') {
620 if (xtype == 'TextArea') {
624 if (xtype == 'Hidden') {
625 delete el.fieldLabel;
628 if (xtype == 'Combobox') {
631 el.queryParam = 'query[' + combofields_name + ']';// SET WHEN USED
633 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
634 el.displayField = combofields_name; // SET WHEN USED eg. project_id
635 el.name = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
636 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
646 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
648 '|beforeload' : 'function (_self, o)' +
650 " o.params = o.params || {};\n" +
651 " // set more here\n" +
657 'xtype' : 'HttpProxy',
660 '|url' : "baseURL + '/Roo/" + reftable + ".php'",
665 'xtype' : 'JsonReader',
669 'totalProperty' : 'total'
680 formElements.push(el);
682 formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
697 "|actioncomplete" : "function(_self,action)\n"+
699 " if (action.type == 'setdata') {\n"+
700 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
703 " if (action.type == 'load') {\n"+
706 " if (action.type =='submit') {\n"+
708 " _this.dialog.hide();\n"+
710 " if (_this.callback) {\n"+
711 " _this.callback.call(_this, action.result.data);\n"+
713 " _this.form.reset();\n"+
718 "|rendered" : "function (form)\n"+
720 " _this.form= form;\n"+
724 style : "margin:10px;",
725 "|url" : "baseURL + '/Roo/" + this.table + "'",
730 alert("IPC:OUT:" + JSON.stringify({
732 "collapsible": false,
733 "height": formHeight,
735 "title": "Edit / Create " + this.table,
738 "xtype": "LayoutDialog",
743 "xtype": "LayoutRegion",
748 "xtype": "ContentPanel",
757 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
759 "*prop": "buttons[]",
766 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
768 "*prop": "buttons[]",
783 activate : function() {
786 _this.grid.footer.onClick('first');