c256636a385df15be002d9da3c61218f426b0ba8
[app.Builder.js] / resources / Editors / Editor.Roo.LayoutDialog.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Editor.Roo');
6
7 Editor.Roo.LayoutDialog = new Roo.XComponent({
8
9  _strings : {
10   'b021df6aac4654c454f46c77646e745f' :"Label",
11   '793548e77e782c209a78ed67f255b5e2' :"Display Field",
12   '0b6519e9da7898cdc668f6016026e71d' :"To JSON",
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"
22  },
23
24   part     :  ["Editors", "LayoutDialog" ],
25   order    : '001-Editor.Roo.LayoutDialog',
26   region   : 'center',
27   parent   : false,
28   name     : "unnamed module",
29   disabled : false, 
30   permname : '', 
31   _tree : function()
32   {
33    var _this = this;
34    var MODULE = this;
35    return {
36    grid : {
37     ds : {
38      '|xns' : 'Roo.data',
39      data : [
40        [ 1, 'test', 'test', 110 ]
41        
42      
43      ],
44      fields : [ 
45          'active', 
46          'dataIndex', 
47          'type',
48          'title', 
49          'width', 
50          'ftype', 
51          'display_field',
52          'relates_to_table',
53          'relates_to_col',
54          'relates_to_schema'
55      ],
56      id : 'dataindex',
57      xns : Roo.data,
58      xtype : 'SimpleStore'
59     },
60     toolbar : {
61      '|xns' : 'Roo',
62      xns : Roo,
63      xtype : 'Toolbar',
64      items : [
65       {
66        '|xns' : 'Roo.Toolbar',
67        text : _this._strings['2f616612593df62aeed112de4f03110e'],
68        xns : Roo.Toolbar,
69        xtype : 'TextItem'
70       },
71       {
72        '|xns' : 'Roo.Toolbar',
73        xns : Roo.Toolbar,
74        xtype : 'Fill'
75       },
76       {
77        '|xns' : 'Roo.Toolbar',
78        text : _this._strings['f541774a08fc687f6e2016c77a6ebca5'],
79        xns : Roo.Toolbar,
80        xtype : 'Button',
81        listeners : {
82         click : function (_self, e)
83          {
84              Roo.log(_this.ftype_combo);
85              var data = {    
86                  "manage_scale_id": {
87                      "Field": "manage_scale_id",
88                      "Type": "int(11)",
89                      "Null": "NO",
90                      "Key": null,
91                      "Default": "0",
92                      "Extra": null,
93                      "relates_to_table": "core_enum",
94                      "relates_to_col": "id",
95                      "relates_to_schema": {
96                          "id": {
97                              "Field": "id",
98                              "Type": "int(11)",
99                              "Null": "NO",
100                              "Key": "PRI",
101                              "Default": null,
102                              "Extra": "auto_increment"
103                          },
104                          "etype": {
105                              "Field": "etype",
106                              "Type": "varchar(32)",
107                              "Null": "NO",
108                              "Key": null,
109                              "Default": null,
110                              "Extra": null
111                          },
112                          "name": {
113                              "Field": "name",
114                              "Type": "varchar(255)",
115                              "Null": "NO",
116                              "Key": null,
117                              "Default": null,
118                              "Extra": null
119                          },
120                          "active": {
121                              "Field": "active",
122                              "Type": "int(2)",
123                              "Null": "NO",
124                              "Key": null,
125                              "Default": "1",
126                              "Extra": null
127                          },
128                          "seqid": {
129                              "Field": "seqid",
130                              "Type": "int(11)",
131                              "Null": "NO",
132                              "Key": "MUL",
133                              "Default": "0",
134                              "Extra": null
135                          },
136                          "seqmax": {
137                              "Field": "seqmax",
138                              "Type": "int(11)",
139                              "Null": "NO",
140                              "Key": null,
141                              "Default": "0",
142                              "Extra": null
143                          },
144                          "display_name": {
145                              "Field": "display_name",
146                              "Type": "text",
147                              "Null": "NO",
148                              "Key": null,
149                              "Default": null,
150                              "Extra": null
151                          },
152                          "is_system_enum": {
153                              "Field": "is_system_enum",
154                              "Type": "int(2)",
155                              "Null": "NO",
156                              "Key": null,
157                              "Default": "0",
158                              "Extra": null
159                          }
160                      }
161                  },
162                  "person_type": {
163                      "Field": "person_type",
164                      "Type": "text",
165                      "Null": "NO",
166                      "Key": null,
167                      "Default": null,
168                      "Extra": null
169                  },
170                  "employer_name": {
171                      "Field": "employer_name",
172                      "Type": "text",
173                      "Null": "NO",
174                      "Key": null,
175                      "Default": null,
176                      "Extra": null
177                  },
178                  "birth_date": {
179                      "Field": "birth_date",
180                      "Type": "date",
181                      "Null": "NO",
182                      "Key": null,
183                      "Default": "0000-00-00",
184                      "Extra": null
185                  },
186                  "employ_start_date": {
187                      "Field": "employ_start_date",
188                      "Type": "date",
189                      "Null": "NO",
190                      "Key": null,
191                      "Default": "0000-00-00",
192                      "Extra": null
193                  },
194                  "employ_end_date": {
195                      "Field": "employ_end_date",
196                      "Type": "date",
197                      "Null": "NO",
198                      "Key": null,
199                      "Default": "0000-00-00",
200                      "Extra": null
201                  },
202                  "hide_same_employer": {
203                      "Field": "hide_same_employer",
204                      "Type": "int(4)",
205                      "Null": "NO",
206                      "Key": null,
207                      "Default": "0",
208                      "Extra": null
209                  },
210                  "salary_currency": {
211                      "Field": "salary_currency",
212                      "Type": "varchar(256)",
213                      "Null": "NO",
214                      "Key": null,
215                      "Default": null,
216                      "Extra": null
217                  },
218                  "quota_currency": {
219                      "Field": "quota_currency",
220                      "Type": "varchar(256)",
221                      "Null": "NO",
222                      "Key": null,
223                      "Default": null,
224                      "Extra": null
225                  },
226                  "created_dt": {
227                      "Field": "created_dt",
228                      "Type": "datetime",
229                      "Null": "NO",
230                      "Key": null,
231                      "Default": "0000-00-00 00:00:00",
232                      "Extra": null
233                  },
234                  "updated_dt": {
235                      "Field": "updated_dt",
236                      "Type": "datetime",
237                      "Null": "NO",
238                      "Key": null,
239                      "Default": "0000-00-00 00:00:00",
240                      "Extra": null
241                  }
242              };
243              
244              Roo.log('debuging...');
245              _this.panel.loadData(data);
246          
247          }
248        }
249       },
250       {
251        '|xns' : 'Roo.Toolbar',
252        text : _this._strings['0b6519e9da7898cdc668f6016026e71d'],
253        xns : Roo.Toolbar,
254        xtype : 'Button',
255        listeners : {
256         click : function (_self, e)
257          {
258              Roo.log(_this.ftype_combo);
259              var data = {    
260                  "manage_scale_id": {
261                      "Field": "manage_scale_id",
262                      "Type": "int(11)",
263                      "Null": "NO",
264                      "Key": null,
265                      "Default": "0",
266                      "Extra": null,
267                      "relates_to_table": "core_enum",
268                      "relates_to_col": "id",
269                      "relates_to_schema": {
270                          "id": {
271                              "Field": "id",
272                              "Type": "int(11)",
273                              "Null": "NO",
274                              "Key": "PRI",
275                              "Default": null,
276                              "Extra": "auto_increment"
277                          },
278                          "etype": {
279                              "Field": "etype",
280                              "Type": "varchar(32)",
281                              "Null": "NO",
282                              "Key": null,
283                              "Default": null,
284                              "Extra": null
285                          },
286                          "name": {
287                              "Field": "name",
288                              "Type": "varchar(255)",
289                              "Null": "NO",
290                              "Key": null,
291                              "Default": null,
292                              "Extra": null
293                          },
294                          "active": {
295                              "Field": "active",
296                              "Type": "int(2)",
297                              "Null": "NO",
298                              "Key": null,
299                              "Default": "1",
300                              "Extra": null
301                          },
302                          "seqid": {
303                              "Field": "seqid",
304                              "Type": "int(11)",
305                              "Null": "NO",
306                              "Key": "MUL",
307                              "Default": "0",
308                              "Extra": null
309                          },
310                          "seqmax": {
311                              "Field": "seqmax",
312                              "Type": "int(11)",
313                              "Null": "NO",
314                              "Key": null,
315                              "Default": "0",
316                              "Extra": null
317                          },
318                          "display_name": {
319                              "Field": "display_name",
320                              "Type": "text",
321                              "Null": "NO",
322                              "Key": null,
323                              "Default": null,
324                              "Extra": null
325                          },
326                          "is_system_enum": {
327                              "Field": "is_system_enum",
328                              "Type": "int(2)",
329                              "Null": "NO",
330                              "Key": null,
331                              "Default": "0",
332                              "Extra": null
333                          }
334                      }
335                  },
336                  "person_type": {
337                      "Field": "person_type",
338                      "Type": "text",
339                      "Null": "NO",
340                      "Key": null,
341                      "Default": null,
342                      "Extra": null
343                  },
344                  "employer_name": {
345                      "Field": "employer_name",
346                      "Type": "text",
347                      "Null": "NO",
348                      "Key": null,
349                      "Default": null,
350                      "Extra": null
351                  },
352                  "birth_date": {
353                      "Field": "birth_date",
354                      "Type": "date",
355                      "Null": "NO",
356                      "Key": null,
357                      "Default": "0000-00-00",
358                      "Extra": null
359                  },
360                  "employ_start_date": {
361                      "Field": "employ_start_date",
362                      "Type": "date",
363                      "Null": "NO",
364                      "Key": null,
365                      "Default": "0000-00-00",
366                      "Extra": null
367                  },
368                  "employ_end_date": {
369                      "Field": "employ_end_date",
370                      "Type": "date",
371                      "Null": "NO",
372                      "Key": null,
373                      "Default": "0000-00-00",
374                      "Extra": null
375                  },
376                  "hide_same_employer": {
377                      "Field": "hide_same_employer",
378                      "Type": "int(4)",
379                      "Null": "NO",
380                      "Key": null,
381                      "Default": "0",
382                      "Extra": null
383                  },
384                  "salary_currency": {
385                      "Field": "salary_currency",
386                      "Type": "varchar(256)",
387                      "Null": "NO",
388                      "Key": null,
389                      "Default": null,
390                      "Extra": null
391                  },
392                  "quota_currency": {
393                      "Field": "quota_currency",
394                      "Type": "varchar(256)",
395                      "Null": "NO",
396                      "Key": null,
397                      "Default": null,
398                      "Extra": null
399                  },
400                  "created_dt": {
401                      "Field": "created_dt",
402                      "Type": "datetime",
403                      "Null": "NO",
404                      "Key": null,
405                      "Default": "0000-00-00 00:00:00",
406                      "Extra": null
407                  },
408                  "updated_dt": {
409                      "Field": "updated_dt",
410                      "Type": "datetime",
411                      "Null": "NO",
412                      "Key": null,
413                      "Default": "0000-00-00 00:00:00",
414                      "Extra": null
415                  }
416              };
417              
418              Roo.log('debuging...');
419              _this.panel.loadData(data);
420          
421          }
422        }
423       }
424      ]
425
426     },
427     '|xns' : 'Roo.grid',
428     autoExpandColumn : 'title',
429     clicksToEdit : 1,
430     loadMask : true,
431     xns : Roo.grid,
432     xtype : 'EditorGrid',
433     cm : [
434       {
435        '|xns' : 'Roo.grid',
436        dataIndex : 'active',
437        header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
438        renderer : function(v) {  
439            var state = v *1 > 0 ?  '-checked' : '';
440        
441            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
442                        
443         },
444        width : 75,
445        xns : Roo.grid,
446        xtype : 'ColumnModel'
447       },
448 {
449        '|xns' : 'Roo.grid',
450        dataIndex : 'dataIndex',
451        header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
452        renderer : function(v) { return String.format('{0}', v); },
453        width : 150,
454        xns : Roo.grid,
455        xtype : 'ColumnModel'
456       },
457 {
458        '|xns' : 'Roo.grid',
459        dataIndex : 'type',
460        header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
461        renderer : function(v) { return String.format('{0}', v); },
462        width : 100,
463        xns : Roo.grid,
464        xtype : 'ColumnModel'
465       },
466 {
467        editor : {
468         field : {
469          '|xns' : 'Roo.form',
470          xns : Roo.form,
471          xtype : 'TextField'
472         },
473         '|xns' : 'Roo.grid',
474         xns : Roo.grid,
475         xtype : 'GridEditor',
476         items : [
477
478         ]
479
480        },
481        '|xns' : 'Roo.grid',
482        dataIndex : 'title',
483        header : _this._strings['b021df6aac4654c454f46c77646e745f'],
484        renderer : function(v) { return String.format('{0}', v); },
485        width : 120,
486        xns : Roo.grid,
487        xtype : 'ColumnModel',
488        items : [
489
490        ]
491
492       },
493 {
494        editor : {
495         field : {
496          store : {
497           '|xns' : 'Roo.data',
498           data : [ 
499               [ 'ComboBox', "ComboBox"],
500               [ 'TextField' , "TextField"],
501               [ 'NumberField', "NumberField"],
502               [ 'TextArea', "TextArea"],
503               [ 'HtmlEditor', "HtmlEditor"],
504               [ 'Hidden', "Hidden"],
505               [ 'DateField', "DateField"],
506               [ 'Checkbox', "Checkbox"]    
507               // checkbox?
508           ],
509           fields : [  'ftype', 'fname'],
510           xns : Roo.data,
511           xtype : 'SimpleStore'
512          },
513          '|xns' : 'Roo.form',
514          allowBlank : false,
515          displayField : 'fname',
516          editable : false,
517          hiddenName : 'status',
518          listWidth : 200,
519          mode : 'local',
520          name : 'ftype',
521          triggerAction : 'all',
522          valueField : 'ftype',
523          width : 150,
524          xns : Roo.form,
525          xtype : 'ComboBox',
526          items : [
527
528          ]
529
530         },
531         '|xns' : 'Roo.grid',
532         xns : Roo.grid,
533         xtype : 'GridEditor',
534         items : [
535
536         ]
537
538        },
539        '|xns' : 'Roo.grid',
540        dataIndex : 'ftype',
541        header : _this._strings['189efd19c4153526994a6d7ea5f6f068'],
542        renderer : function(v) { return String.format('{0}', v); },
543        width : 120,
544        xns : Roo.grid,
545        xtype : 'ColumnModel',
546        items : [
547
548        ]
549
550       },
551 {
552        editor : {
553         field : {
554          store : {
555           '|xns' : 'Roo.data',
556           data : [ 
557               ['id']
558           ],
559           fields : [  'dfield'],
560           xns : Roo.data,
561           xtype : 'SimpleStore'
562          },
563          '|xns' : 'Roo.form',
564          allowBlank : false,
565          displayField : 'dfield',
566          editable : false,
567          hiddenName : 'status',
568          listWidth : 200,
569          mode : 'local',
570          name : 'display_field',
571          triggerAction : 'all',
572          valueField : 'dfield',
573          width : 150,
574          xns : Roo.form,
575          xtype : 'ComboBox',
576          items : [
577
578          ]
579
580         },
581         '|xns' : 'Roo.grid',
582         xns : Roo.grid,
583         xtype : 'GridEditor',
584         items : [
585
586         ]
587
588        },
589        '|xns' : 'Roo.grid',
590        dataIndex : 'display_field',
591        header : _this._strings['793548e77e782c209a78ed67f255b5e2'],
592        renderer : function(v) { return String.format('{0}', v); },
593        width : 150,
594        xns : Roo.grid,
595        xtype : 'ColumnModel',
596        items : [
597
598        ]
599
600       },
601 {
602        editor : {
603         field : {
604          '|xns' : 'Roo.form',
605          decimalPrecision : 0,
606          xns : Roo.form,
607          xtype : 'NumberField'
608         },
609         '|xns' : 'Roo.grid',
610         xns : Roo.grid,
611         xtype : 'GridEditor',
612         items : [
613
614         ]
615
616        },
617        '|xns' : 'Roo.grid',
618        dataIndex : 'width',
619        header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
620        renderer : function(v) { return String.format('{0}', v); },
621        width : 75,
622        xns : Roo.grid,
623        xtype : 'ColumnModel',
624        items : [
625
626        ]
627
628       }
629     ],
630     listeners : {
631      beforeedit : function (e)
632       {
633           Roo.log('before edit!!!');
634           Roo.log(e);
635           
636           if(e.field != 'display_field'){
637               return;
638           }
639           
640           _this.grid.colModel.getCellEditor(e.column, e.row).field.store.loadData(e.record.data.relates_to_schema);
641       },
642      cellclick : function (_self, rowIndex, columnIndex, e)
643       {
644       
645               var di = this.colModel.getDataIndex(columnIndex);
646               if (di != 'active') {
647                   return;
648               }
649                
650               var rec = _this.grid.ds.getAt(rowIndex);
651               
652               rec.set('active', rec.data.active * 1 ? 0 : 1);
653               rec.commit();
654                
655               
656       },
657      render : function() 
658       {
659           _this.grid = this; 
660           //_this.dialog = Pman.Dialog.FILL_IN
661       
662       },
663      rowdblclick : function (_self, rowIndex, e)
664       {
665           if (!_this.dialog) return;
666         
667       }
668     },
669     items : [
670
671     ]
672
673    },
674    '|xns' : 'Roo',
675    background : false,
676    fitContainer : true,
677    fitToframe : true,
678    loadData : function(data) { 
679    
680        //alert("IPC:TEST:" + JSON.stringify(data,null,4));
681    
682        var fields = _this.grid.dataSource.reader.recordType.prototype.fields;
683        
684        
685        var d = [];
686    
687        for (var k in data) { 
688            var r = data[k];
689            var has_s = typeof(r.relates_to_schema) != 'undefined';
690            
691            var rt = '', rc = '', rs = [];
692            
693            if(has_s){
694                for (var kk in r.relates_to_schema) {         
695                    var rr = r.relates_to_schema[kk];
696                    
697                    rt = r.relates_to_table;
698                    rc = r.relates_to_col;
699                    
700                    rs.push([rr.Field]);
701                    
702                }
703            }
704            
705            var o = {
706                active : !has_s,
707                dataIndex : r.Field,
708                type : r.Type,
709                title : r.Field,
710                width : 100,
711                ftype : 'TextField',
712                display_field : rc, //r.Field + '_display_name',
713                relates_to_table : rt,
714                relates_to_col : rc,
715                relates_to_schema : rs
716            };
717            
718            d.push(o);
719            
720            if (!has_s) {
721                continue;
722            }
723            
724            for (var kk in r.relates_to_schema) {         
725                var rr = r.relates_to_schema[kk];
726                if (rr.Field == r.relates_to_col) {
727                    continue;
728                }
729                
730                var o = {
731                    active : false,
732                    dataIndex : r.Field + '_'+ rr.Field,
733                    type : r.Type,
734                    title : r.Field,
735                    width : 100
736                };
737                
738                d.push(o);
739            }
740        }
741    
742        var ar = [];
743        
744        Roo.each(d, function(dd){
745    
746            var a = [];
747            
748            for(var j = 0; j < fields.length; j++){
749                var f = fields.items[j];
750                
751                if(dd.hasOwnProperty(f.name)){
752                    a.push(dd[f.name]);
753                }
754            }
755            
756            ar.push(a);
757        });
758        
759        
760        Roo.log(ar);
761        this.schema = data;
762        
763        //alert("IPC:TEST:" + JSON.stringify(ar));
764        this.grid.dataSource.loadData(ar);
765    },
766    region : 'center',
767    tableName : 'core_enum',
768    title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
769    title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
770    toBJS : function() { 
771    
772    // convert the selected cells into a BJS data ready to send back to the UI..
773    
774        this.table = "XXX";
775        this.firstTxtCol = "XXX";
776       
777        var formHeight = 50;
778        
779        var jreader = {};
780        var  formElements = [];
781        this.grid.dataSource.each(function(rec) {
782            if (!rec.data.active) {
783                return;
784            }
785            
786            var el = {
787                fieldLabel : rec.data.title,
788                name : rec.data.dataIndex,
789                width : r.data.width,
790                '|xns' : 'Roo.form',
791                xtype : rec.data.ftype
792            }
793             if (xtype == 'DateField') {
794                el.format = 'Y-m-d';
795                el.useIso = true;
796                el.width = 100;
797            }
798            
799            if (xtype == 'TextArea') {
800                el.height = 100;
801            }
802            
803            if (xtype == 'Hidden') {
804                delete el.fieldLabel;
805                delete el.width;
806            }
807            if (xtype == 'Combobox') {
808            
809    
810                el.queryParam  = 'query[' + rec.data.display_field + ']';// SET WHEN USED
811                
812                el.hiddenName = rec.data.dataIndex // SET WHEN USED eg. project_id
813                el.name  = rec.data.dataIndex + '_' + rec.data.display_field; // SET WHEN USED eg. project_id_name
814                
815                el.displayField = rec.data.display_field // SET WHEN USED eg. project_id
816                el.valueField = rec.data.relates_to_col 
817                
818                el.tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + rec.data.display_field +'}</b> </div>'; // SET WHEN USED
819              
820            
821               el.items = [
822                    {
823                            
824                        '*prop' : 'store',
825                        'xtype' : 'Store',
826                        '|xns' : 'Roo.data',
827                        'remoteSort' : true,
828                        '|sortInfo' : '{ direction : \'ASC\', field: \'id\' }',
829                        listeners : {
830                            '|beforeload' : 'function (_self, o)' +
831                            "{\n" +
832                            "    o.params = o.params || {};\n" +
833                            "    // set more here\n" +
834                            "}\n"
835                        },
836                        items : [
837                            {
838                                '*prop' : 'proxy',
839                                'xtype' : 'HttpProxy',
840                                'method' : 'GET',
841                                '|xns' : 'Roo.data',
842                                '|url' : "baseURL + '/Roo/" + rec.data.relates_to_table + ".php'",
843                            },
844                            
845                            {
846                                '*prop' : 'reader',
847                                'xtype' : 'JsonReader',
848                                '|xns' : 'Roo.data',
849                                'id' : 'id',
850                                'root' : 'data',
851                                'totalProperty' : 'total'
852    
853                                
854                            }
855                        ]
856                    }
857                ];
858            
859            }
860            
861            if (xtype == 'HtmlEditor') {
862                el.height = 100,
863                el.resizable = 's',
864                el.toolbar = [
865                    {
866                        '|xns' : 'Roo.form.HtmlEditor',
867                        'xtype' : 'ToolbarContext'
868                    },
869                    {
870                        '|xns' : 'Roo.form.HtmlEditor',
871                        'xtype' : 'ToolbarStandard'
872    
873                   }
874                ]
875            }
876            
877            formElements.push(el);
878            
879            formHeight += rec.data.ftype == 'TextArea' ? 100 : 30;
880            
881            
882        });
883        
884        
885        
886        
887        
888        
889         var frmCfg = 
890        {
891            '|xns' : 'Roo.form',
892            xtype : "Form",
893            listeners : {
894                "|actioncomplete" : "function(_self,action)\n"+
895                    "{\n"+
896                    "    if (action.type == 'setdata') {\n"+
897                    "       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n"+
898                    "       return;\n"+
899                    "    }\n"+
900                    "    if (action.type == 'load') {\n"+
901                    "        return;\n"+
902                    "    }\n"+
903                    "    if (action.type =='submit') {\n"+
904                    "    \n"+
905                    "        _this.dialog.hide();\n"+
906                    "    \n"+
907                    "         if (_this.callback) {\n"+
908                    "            _this.callback.call(_this, action.result.data);\n"+
909                    "         }\n"+
910                    "         _this.form.reset();\n"+
911                    "         return;\n"+
912                    "    }\n"+
913                    "}\n",
914                
915                "|rendered" : "function (form)\n"+
916                    "{\n"+
917                    "    _this.form= form;\n"+
918                    "}\n"
919            },
920            method : "POST",
921            style : "margin:10px;",
922            "|url" : "baseURL + '/Roo/" + this.table + "'",
923            items : formElements
924        };
925        
926    
927        alert("IPC:OUT:" + JSON.stringify({
928                "closable": false,
929                "collapsible": false,
930                "height": formHeight,
931                "resizable": false,
932                "title": "Edit / Create " + this.table,
933                "width": 400,
934                "modal" : true,
935                "xtype": "LayoutDialog",
936                "|xns": "Roo",
937                "items": [
938                    {
939                        "|xns": "Roo",
940                        "xtype": "LayoutRegion",
941                        "*prop": "center"
942                    },
943                    {
944                        "region": "center",
945                        "xtype": "ContentPanel",
946                        "|xns": "Roo",
947                        "items": [
948                            frmCfg
949                        ]
950                    },
951                    
952                    {
953                        "listeners": {
954                            "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
955                        },
956                        "*prop": "buttons[]",
957                        "text": "Cancel",
958                        "xtype": "Button",
959                        "|xns": "Roo"
960                    },
961                    {
962                        "listeners": {
963                            "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
964                        },
965                        "*prop": "buttons[]",
966                        "text": "Save",
967                        "xtype": "Button",
968                        "|xns": "Roo"
969                    }
970                ]
971            
972            
973            
974        }, null, 4));
975    
976    },
977    xns : Roo,
978    xtype : 'GridPanel',
979    listeners : {
980     activate : function() {
981          _this.panel = this;
982          if (_this.grid) {
983              _this.grid.footer.onClick('first');
984          }
985      }
986    },
987    items : [
988
989    ]
990
991   };  }
992 });