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           if (_this.panel.active) {
175              this.footer.onClick('first');
176           }
177       },
178      rowdblclick : function (_self, rowIndex, e)
179       {
180           if (!_this.dialog) return;
181           _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
182               _this.grid.footer.onClick('first');
183           }); 
184       }
185     },
186     items : [
187
188     ]
189
190    },
191    '|xns' : 'Roo',
192    background : false,
193    fitContainer : true,
194    fitToframe : true,
195    loadData : function(data) { 
196    
197         alert("IPC:TEST:" + JSON.stringify(data,null,4));
198        var ar = [];
199        for (var k in data) { 
200            var r = data[k];
201            ar.push([ false, r.Field, r.Type,  r.Field, 100] );
202        }
203        
204        alert("IPC:TEST:" + JSON.stringify(ar));
205        this.grid.dataSource.loadData(ar);
206    },
207    region : 'center',
208    tableName : 'core_enum',
209    title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
210    title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
211    xns : Roo,
212    xtype : 'GridPanel',
213    listeners : {
214     activate : function() {
215          _this.panel = this;
216          if (_this.grid) {
217              _this.grid.footer.onClick('first');
218          }
219      }
220    },
221    items : [
222
223    ]
224
225   };  }
226 });