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',
251 text : _this._strings['040076bde7f6b3387448e32b66c2eee0'],
255 click : function (_self, e)
258 Roo.log('Converting to BJS...');
268 autoExpandColumn : 'title',
272 xtype : 'EditorGrid',
276 dataIndex : 'active',
277 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
278 renderer : function(v) {
279 var state = v *1 > 0 ? '-checked' : '';
281 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
286 xtype : 'ColumnModel'
290 dataIndex : 'dataIndex',
291 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
292 renderer : function(v) { return String.format('{0}', v); },
295 xtype : 'ColumnModel'
300 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
301 renderer : function(v) { return String.format('{0}', v); },
304 xtype : 'ColumnModel'
315 xtype : 'GridEditor',
323 header : _this._strings['b021df6aac4654c454f46c77646e745f'],
324 renderer : function(v) { return String.format('{0}', v); },
327 xtype : 'ColumnModel',
339 [ 'ComboBox', "ComboBox"],
340 [ 'TextField' , "TextField"],
341 [ 'NumberField', "NumberField"],
342 [ 'TextArea', "TextArea"],
343 [ 'HtmlEditor', "HtmlEditor"],
344 [ 'Hidden', "Hidden"],
345 [ 'DateField', "DateField"],
346 [ 'Checkbox', "Checkbox"]
349 fields : [ 'ftype', 'fname'],
351 xtype : 'SimpleStore'
355 displayField : 'fname',
357 hiddenName : 'status',
361 triggerAction : 'all',
362 valueField : 'ftype',
373 xtype : 'GridEditor',
381 header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
382 renderer : function(v) { return String.format('{0}', v); },
385 xtype : 'ColumnModel',
399 fields : [ 'dfield'],
401 xtype : 'SimpleStore'
405 displayField : 'dfield',
407 hiddenName : 'status',
410 name : 'display_field',
411 triggerAction : 'all',
412 valueField : 'dfield',
423 xtype : 'GridEditor',
430 dataIndex : 'display_field',
431 header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
432 renderer : function(v) { return String.format('{0}', v); },
435 xtype : 'ColumnModel',
445 decimalPrecision : 0,
447 xtype : 'NumberField'
451 xtype : 'GridEditor',
459 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
460 renderer : function(v) { return String.format('{0}', v); },
463 xtype : 'ColumnModel',
471 beforeedit : function (e)
473 Roo.log('before edit!!!');
476 if(e.field != 'display_field'){
480 _this.grid.colModel.getCellEditor(e.column, e.row).field.store.loadData(e.record.data.relates_to_schema);
482 cellclick : function (_self, rowIndex, columnIndex, e)
485 var di = this.colModel.getDataIndex(columnIndex);
486 if (di != 'active') {
490 var rec = _this.grid.ds.getAt(rowIndex);
492 rec.set('active', rec.data.active * 1 ? 0 : 1);
500 //_this.dialog = Pman.Dialog.FILL_IN
503 rowdblclick : function (_self, rowIndex, e)
505 if (!_this.dialog) return;
518 loadData : function(data) {
520 //alert("IPC:TEST:" + JSON.stringify(data,null,4));
522 var fields = _this.grid.dataSource.reader.recordType.prototype.fields;
527 for (var k in data) {
529 var has_s = typeof(r.relates_to_schema) != 'undefined';
531 var rt = '', rc = '', rs = [];
534 for (var kk in r.relates_to_schema) {
535 var rr = r.relates_to_schema[kk];
537 rt = r.relates_to_table;
538 rc = r.relates_to_col;
552 display_field : rc, //r.Field + '_display_name',
553 relates_to_table : rt,
555 relates_to_schema : rs
564 for (var kk in r.relates_to_schema) {
565 var rr = r.relates_to_schema[kk];
566 if (rr.Field == r.relates_to_col) {
572 dataIndex : r.Field + '_'+ rr.Field,
584 Roo.each(d, function(dd){
588 for(var j = 0; j < fields.length; j++){
589 var f = fields.items[j];
591 if(dd.hasOwnProperty(f.name)){
603 //alert("IPC:TEST:" + JSON.stringify(ar));
604 this.grid.dataSource.loadData(ar);
607 tableName : 'core_enum',
608 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
609 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
612 // convert the selected cells into a BJS data ready to send back to the UI..
615 this.firstTxtCol = "XXX";
620 var formElements = [];
621 this.grid.dataSource.each(function(rec) {
622 if (!rec.data.active) {
627 fieldLabel : rec.data.title,
628 name : rec.data.dataIndex,
629 width : r.data.width,
631 xtype : rec.data.ftype
633 if (xtype == 'DateField') {
639 if (xtype == 'TextArea') {
643 if (xtype == 'Hidden') {
644 delete el.fieldLabel;
647 if (xtype == 'Combobox') {
650 el.queryParam = 'query[' + rec.data.display_field + ']';// SET WHEN USED
652 el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
653 el.name = rec.data.dataIndex + '_' + rec.data.display_field; // SET WHEN USED eg. project_id_name
655 el.displayField = rec.data.display_field // SET WHEN USED eg. project_id
656 el.valueField = rec.data.relates_to_col
658 el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + rec.data.display_field +'}</b> </div>'; // SET WHEN USED
668 '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
670 '|beforeload' : 'function (_self, o)' +
672 " o.params = o.params || {};\n" +
673 " // set more here\n" +
679 'xtype' : 'HttpProxy',
682 '|url' : "baseURL + '/Roo/" + rec.data.relates_to_table + ".php'",
687 'xtype' : 'JsonReader',
691 'totalProperty' : 'total'
701 if (xtype == 'HtmlEditor') {
706 '|xns' : 'Roo.form.HtmlEditor',
707 'xtype' : 'ToolbarContext'
710 '|xns' : 'Roo.form.HtmlEditor',
711 'xtype' : 'ToolbarStandard'
717 formElements.push(el);
719 formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
734 "|actioncomplete" : "function(_self,action)\n"+
736 " if (action.type == 'setdata') {\n"+
737 " //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
740 " if (action.type == 'load') {\n"+
743 " if (action.type =='submit') {\n"+
745 " _this.dialog.hide();\n"+
747 " if (_this.callback) {\n"+
748 " _this.callback.call(_this, action.result.data);\n"+
750 " _this.form.reset();\n"+
755 "|rendered" : "function (form)\n"+
757 " _this.form= form;\n"+
761 style : "margin:10px;",
762 "|url" : "baseURL + '/Roo/" + this.table + "'",
767 alert("IPC:OUT:" + JSON.stringify({
769 "collapsible": false,
770 "height": formHeight,
772 "title": "Edit / Create " + this.table,
775 "xtype": "LayoutDialog",
780 "xtype": "LayoutRegion",
785 "xtype": "ContentPanel",
794 "click": "function (_self, e)\n{\n _this.dialog.hide();\n}"
796 "*prop": "buttons[]",
803 "click": "function (_self, e)\n{\n // do some checks?\n \n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n\n}"
805 "*prop": "buttons[]",
820 activate : function() {
823 _this.grid.footer.onClick('first');