annotate app/view/proben/List.js @ 239:f57b496b4caa

Added function to dynamically add columns to the probenlist.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 23 Jul 2013 11:30:03 +0200
parents 2a23fcca8ead
children c8c53f162a22
rev   line source
4
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.view.proben.List' ,{
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 extend: 'Ext.grid.Panel',
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 alias: 'widget.probenlist',
13
a8efc4b96888 Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 4
diff changeset
4 store: 'Proben',
37
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
5 viewConfig: {
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
6 maxHeight: 350,
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
7 emptyText: 'Keine Proben gefunden.',
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
8 // minHeight and deferEmptyText are needed to be able to show the
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
9 // emptyText message.
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
10 minHeight: 35,
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
11 deferEmptyText: false
e9229d79e430 Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 30
diff changeset
12 },
237
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
13 availableColumns: [
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
14 {header: 'Datenbasis', dataIndex: 'datenbasisId', width: 70},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
15 {header: 'MPL', dataIndex: 'mplId', width: 50},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
16 {header: 'UWB', dataIndex: 'umwId', width: 50},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
17 {header: 'MMT', dataIndex: 'messmethode'},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
18 {header: 'HPNR', dataIndex: 'hauptprobenNr'},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
19 {header: 'NPNR', dataIndex: 'nebenprobenNr'},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
20 {header: 'E.Gemeinde', dataIndex: 'bezeichnung', flex: 1},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
21 {header: 'Ursprungsgemeinde', dataIndex: 'kreis', flex: 1},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
22 {header: 'ProbeID', dataIndex: 'probeId'},
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
23 {header: 'MST', dataIndex: 'mstId', width: 50}
bc2d46a67bbd Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 99
diff changeset
24 ],
4
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 initComponent: function() {
63
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
26 this.dockedItems = [
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
27 {
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
28 xtype: 'toolbar',
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
29 dock: 'top',
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
30 items: [
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
31 {
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
32 text: 'Hinzufügen',
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
33 icon: 'gfx/plus.gif',
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
34 action: 'add'
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
35 }
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
36 ]
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
37 }
f7d40f8a6902 Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 37
diff changeset
38 ];
238
2a23fcca8ead On Default the proben list will have no columns at all. The are added
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 237
diff changeset
39 this.columns = [];
4
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 this.callParent(arguments);
239
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
41 },
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
42 setupColumns: function(colnames) {
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
43 var cols = []
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
44 for (var i = colnames.length - 1; i >= 0; i--){
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
45 col = colnames[i];
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
46 for (var j = this.availableColumns.length - 1; j >= 0; j--){
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
47 defaultCol = this.availableColumns[j];
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
48 if (defaultCol.dataIndex === col) {
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
49 cols.push(this.availableColumns[j])
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
50 };
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
51 };
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
52 };
f57b496b4caa Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 238
diff changeset
53 this.reconfigure(this.store, cols);
4
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
54 }
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
55 });

http://lada.wald.intevation.org