comparison app/view/proben/List.js @ 374:832e3c8f9191

Implemented dynamic ProbelList model. The model will get initialized by the fields configured in the sql configuration.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 20 Aug 2013 16:50:47 +0200
parents d0f5be50aed5
children eb79d9bf3929
comparison
equal deleted inserted replaced
373:9b663418b614 374:832e3c8f9191
2 * Grid to list Proben 2 * Grid to list Proben
3 */ 3 */
4 Ext.define('Lada.view.proben.List' ,{ 4 Ext.define('Lada.view.proben.List' ,{
5 extend: 'Ext.grid.Panel', 5 extend: 'Ext.grid.Panel',
6 alias: 'widget.probenlist', 6 alias: 'widget.probenlist',
7 store: 'Proben', 7 store: 'ProbenList',
8 viewConfig: { 8 viewConfig: {
9 maxHeight: 350, 9 maxHeight: 350,
10 emptyText: 'Keine Proben gefunden.', 10 emptyText: 'Keine Proben gefunden.',
11 // minHeight and deferEmptyText are needed to be able to show the 11 // minHeight and deferEmptyText are needed to be able to show the
12 // emptyText message. 12 // emptyText message.
13 minHeight: 35, 13 minHeight: 35,
14 deferEmptyText: false 14 deferEmptyText: false
15 }, 15 },
16 availableColumns: [
17 {header: 'Datenbasis', dataIndex: 'datenbasisId', width: 70},
18 {header: 'MPL', dataIndex: 'mplId', width: 50},
19 {header: 'UWB', dataIndex: 'umwId', width: 50},
20 {header: 'MMT', dataIndex: 'messmethode'},
21 {header: 'HPNR', dataIndex: 'hauptprobenNr'},
22 {header: 'NPNR', dataIndex: 'nebenprobenNr'},
23 {header: 'E.Gemeinde', dataIndex: 'bezeichnung', flex: 1},
24 {header: 'Ursprungsgemeinde', dataIndex: 'kreis', flex: 1},
25 {header: 'ProbeID', dataIndex: 'probeId'},
26 {header: 'MST', dataIndex: 'mstId', width: 50}
27 ],
28 initComponent: function() { 16 initComponent: function() {
29 this.dockedItems = [ 17 this.dockedItems = [
30 { 18 {
31 xtype: 'toolbar', 19 xtype: 'toolbar',
32 dock: 'top', 20 dock: 'top',
53 * select sql event} 41 * select sql event}
54 * @parameter {Array} List of cols to show in the Grid. 42 * @parameter {Array} List of cols to show in the Grid.
55 */ 43 */
56 setupColumns: function(cols) { 44 setupColumns: function(cols) {
57 var rcols = []; 45 var rcols = [];
46 var mfields = [];
47
58 rcols.push({header: 'RW', dataIndex: 'readonly', width: 30, renderer: render_readonly}); 48 rcols.push({header: 'RW', dataIndex: 'readonly', width: 30, renderer: render_readonly});
49 mfields.push(new Ext.data.Field({name: 'readonly'}));
59 for (var i = cols.length - 1; i >= 0; i--){ 50 for (var i = cols.length - 1; i >= 0; i--){
60 rcols.push(cols[i]); 51 rcols.push(cols[i]);
52 mfields.push(new Ext.data.Field({name: cols[i].dataIndex}));
61 } 53 }
54 this.store.model.setFields(mfields);
62 this.reconfigure(this.store, rcols); 55 this.reconfigure(this.store, rcols);
63 } 56 }
64 }); 57 });
65 58
66 /** 59 /**

http://lada.wald.intevation.org