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.grid');
7 Editor.Roo.grid.Grid = new Roo.XComponent({
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"
20 part : ["Editors", "Grid" ],
21 order : '001-Editor.Roo.grid.Grid',
24 name : "unnamed module",
36 [ 1, 'test', 'test', 110 ]
40 fields : [ 'active', 'dataIndex', 'type','title', 'width' ],
51 '|xns' : 'Roo.Toolbar',
52 text : _this._strings['2f616612593df62aeed112de4f03110e'],
60 autoExpandColumn : 'title',
69 header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
70 renderer : function(v) {
71 var state = v *1 > 0 ? '-checked' : '';
73 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
82 dataIndex : 'dataIndex',
83 header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
84 renderer : function(v) { return String.format('{0}', v); },
92 header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
93 renderer : function(v) { return String.format('{0}', v); },
107 xtype : 'GridEditor',
115 header : _this._strings['b78a3223503896721cca1303f776159b'],
116 renderer : function(v) { return String.format('{0}', v); },
119 xtype : 'ColumnModel',
129 decimalPrecision : 0,
131 xtype : 'NumberField'
135 xtype : 'GridEditor',
143 header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
144 renderer : function(v) { return String.format('{0}', v); },
147 xtype : 'ColumnModel',
155 cellclick : function (_self, rowIndex, columnIndex, e)
158 var di = this.colModel.getDataIndex(columnIndex);
159 if (di != 'active') {
163 var rec = _this.grid.ds.getAt(rowIndex);
165 rec.set('active', rec.data.active * 1 ? 0 : 1);
173 //_this.dialog = Pman.Dialog.FILL_IN
176 rowdblclick : function (_self, rowIndex, e)
178 if (!_this.dialog) return;
191 loadData : function(data) {
193 alert("IPC:TEST:" + JSON.stringify(data,null,4));
195 for (var k in data) {
197 var has_s = typeof(r.relates_to_schema) != 'undefined'
198 ar.push([ !has_s , r.Field, r.Type, r.Field, 100] );
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) {
207 ar.push([ false, r.Field + '_'+ rr.Field, rr.Type, rr.Field, 100] );
211 alert("IPC:TEST:" + JSON.stringify(ar));
212 this.grid.dataSource.loadData(ar);
215 tableName : 'core_enum',
216 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
217 title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
220 // convert the selected cells into a BJS data ready to send back to the UI..
223 this.firstTxtCol = "XXX";
228 this.grid.dataSource.each(function(rec) {
229 if (!rec.data.active) {
236 "xtype": "ColumnModel",
237 "header": rec.data.title,
238 "width": rec.data.width * 1,
239 "dataIndex": rec.data.dataIndex,
240 "|renderer": !rec.data.type.match(/date/i) ?
241 "function(v) { return String.format('{0}', v); }" :
242 "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }" , // special for date
244 "*prop": "colModel[]"
251 alert("IPC:OUT:" + JSON.stringify({
256 "fitContainer": true,
257 "tableName": this.table,
261 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
267 "autoExpandColumn": this.firstTxtCol,
270 "|render": "function() \n" +
272 " _this.grid = this; \n" +
273 " //_this.dialog = Pman.Dialog.FILL_IN\n" +
274 " if (_this.panel.active) {\n" +
275 " this.footer.onClick('first');\n" +
278 "|rowdblclick": "function (_self, rowIndex, e)\n" +
280 " if (!_this.dialog) return;\n" +
281 " _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n" +
282 " _this.grid.footer.onClick('first');\n" +
290 "*prop": "dataSource",
293 '|sortInfo' : "{ field : '" + this.firstTxtCol + "', direction: 'ASC' }",
299 "xtype": "HttpProxy",
301 "|url": "baseURL + '/Roo/" + this.table + ".php'",
306 'xtype' : 'JsonReader',
310 'totalProperty' : 'total'
316 "xtype": "PagingToolbar",
319 "displayMsg": "Displaying " + this.table + "{0} - {1} of {2}",
320 "emptyMsg": "No " + this.table + " found",
331 "cls": "x-btn-text-icon",
332 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
334 "|click": "function()\n"+
336 " if (!_this.dialog) return;\n" +
337 " _this.dialog.show( { id : 0 } , function() {\n"+
338 " _this.grid.footer.onClick('first');\n"+
342 "|xns": "Roo.Toolbar"
347 "cls": "x-btn-text-icon",
348 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
351 "|click": "function()\n"+
353 " Pman.genericDelete(_this, '" + this.table + "'); \n"+
357 "|xns": "Roo.Toolbar"
372 activate : function() {
375 _this.grid.footer.onClick('first');