resources/Editors/Editor.Roo.grid.Grid.bjs
[app.Builder.js] / resources / Editors / Editor.Roo.grid.Grid.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.grid');
6
7 Editor.Roo.grid.Grid = new Roo.XComponent({
8
9  _strings : {
10   '4ce58cbe362a5d7b156992a496d55bf3' :"Database Column",
11   'b78a3223503896721cca1303f776159b' :"Title",
12   '2f616612593df62aeed112de4f03110e' :"Edit a Grid",
13   '0ccc2bf3fb98387c23b6ca5500244d6e' :"Use ",
14   'c671c787b49f50a3ace9fdc5bd597825' :"core_enum",
15   '32954654ac8fe66a1d09be19001de2d4' :"Width",
16   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
17   '6e7376dca68a2386a8737944196ab491' :"Create / Edit Grid"
18  },
19
20   part     :  ["Editors", "Grid" ],
21   order    : '001-Editor.Roo.grid.Grid',
22   region   : 'center',
23   parent   : false,
24   name     : "unnamed module",
25   disabled : false, 
26   permname : '', 
27   _tree : function()
28   {
29    var _this = this;
30    var MODULE = this;
31    return {
32    grid : {
33     ds : {
34      '|xns' : 'Roo.data',
35      data : [
36        [ 1, 'test', 'test', 110 ]
37        
38      
39      ],
40      fields : [ 'active', 'dataIndex', 'type','title', 'width' ],
41      id : 'dataindex',
42      xns : Roo.data,
43      xtype : 'SimpleStore'
44     },
45     toolbar : {
46      '|xns' : 'Roo',
47      xns : Roo,
48      xtype : 'Toolbar',
49      items : [
50       {
51        '|xns' : 'Roo.Toolbar',
52        text : _this._strings['2f616612593df62aeed112de4f03110e'],
53        xns : Roo.Toolbar,
54        xtype : 'TextItem'
55       }
56      ]
57
58     },
59     '|xns' : 'Roo.grid',
60     autoExpandColumn : 'title',
61     clicksToEdit : 1,
62     loadMask : true,
63     xns : Roo.grid,
64     xtype : 'EditorGrid',
65     cm : [
66       {
67        '|xns' : 'Roo.grid',
68        dataIndex : 'active',
69        header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
70        renderer : function(v) {  
71            var state = v *1 > 0 ?  '-checked' : '';
72        
73            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
74                        
75         },
76        width : 75,
77        xns : Roo.grid,
78        xtype : 'ColumnModel'
79       },
80 {
81        '|xns' : 'Roo.grid',
82        dataIndex : 'dataIndex',
83        header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
84        renderer : function(v) { return String.format('{0}', v); },
85        width : 150,
86        xns : Roo.grid,
87        xtype : 'ColumnModel'
88       },
89 {
90        '|xns' : 'Roo.grid',
91        dataIndex : 'type',
92        header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
93        renderer : function(v) { return String.format('{0}', v); },
94        width : 100,
95        xns : Roo.grid,
96        xtype : 'ColumnModel'
97       },
98 {
99        editor : {
100         field : {
101          '|xns' : 'Roo.form',
102          xns : Roo.form,
103          xtype : 'TextField'
104         },
105         '|xns' : 'Roo.grid',
106         xns : Roo.grid,
107         xtype : 'GridEditor',
108         items : [
109
110         ]
111
112        },
113        '|xns' : 'Roo.grid',
114        dataIndex : 'title',
115        header : _this._strings['b78a3223503896721cca1303f776159b'],
116        renderer : function(v) { return String.format('{0}', v); },
117        width : 75,
118        xns : Roo.grid,
119        xtype : 'ColumnModel',
120        items : [
121
122        ]
123
124       },
125 {
126        editor : {
127         field : {
128          '|xns' : 'Roo.form',
129          decimalPrecision : 0,
130          xns : Roo.form,
131          xtype : 'NumberField'
132         },
133         '|xns' : 'Roo.grid',
134         xns : Roo.grid,
135         xtype : 'GridEditor',
136         items : [
137
138         ]
139
140        },
141        '|xns' : 'Roo.grid',
142        dataIndex : 'width',
143        header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
144        renderer : function(v) { return String.format('{0}', v); },
145        width : 75,
146        xns : Roo.grid,
147        xtype : 'ColumnModel',
148        items : [
149
150        ]
151
152       }
153     ],
154     listeners : {
155      cellclick : function (_self, rowIndex, columnIndex, e)
156       {
157       
158               var di = this.colModel.getDataIndex(columnIndex);
159               if (di != 'active') {
160                   return;
161               }
162                
163               var rec = _this.grid.ds.getAt(rowIndex);
164               
165               rec.set('active', rec.data.active * 1 ? 0 : 1);
166               rec.commit();
167                
168               
169       },
170      render : function() 
171       {
172           _this.grid = this; 
173           //_this.dialog = Pman.Dialog.FILL_IN
174       
175       },
176      rowdblclick : function (_self, rowIndex, e)
177       {
178           if (!_this.dialog) return;
179         
180       }
181     },
182     items : [
183
184     ]
185
186    },
187    '|xns' : 'Roo',
188    background : false,
189    fitContainer : true,
190    fitToframe : true,
191    loadData : function(data) { 
192    
193         alert("IPC:TEST:" + JSON.stringify(data,null,4));
194        var ar = [];
195        for (var k in data) { 
196            var r = data[k];
197            var has_s = typeof(r.relates_to_schema) != 'undefined'
198            ar.push([ !has_s , r.Field, r.Type,  r.Field, 100] );
199            if (!has_s) {
200                continue;
201            }
202            for (var kk in r.relates_to_schema) {         
203                var rr = r.relates_to_schema[kk];
204                if (rr.Field == r.relates_to_col) {
205                    continue;
206                }
207                ar.push([ false, r.Field + '_'+ rr.Field, rr.Type,  rr.Field, 100] );
208            }
209        }
210        
211        alert("IPC:TEST:" + JSON.stringify(ar));
212        this.grid.dataSource.loadData(ar);
213    },
214    region : 'center',
215    tableName : 'core_enum',
216    title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
217    title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
218    xns : Roo,
219    xtype : 'GridPanel',
220    listeners : {
221     activate : function() {
222          _this.panel = this;
223          if (_this.grid) {
224              _this.grid.footer.onClick('first');
225          }
226      }
227    },
228    items : [
229
230    ]
231
232   };  }
233 });