Mercurial > lada > lada-client
annotate app/view/zusatzwerte/List.js @ 162:5eb0cfac0e30
Added nested id attribute which comes in JSON response to the model as we need
it later in the grid view to be able to acess messungsIs and probeId in the
custom renderer.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 03 Jul 2013 14:02:35 +0200 |
parents | 1fb79e16149f |
children | 8cb393ffe844 |
rev | line source |
---|---|
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.view.zusatzwerte.List' ,{ |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.grid.Panel', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 alias: 'widget.zusatzwertelist', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 store: 'Zusatzwerte', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 viewConfig: { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 maxHeight: 350, |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 emptyText: 'Keine Zusatzwerte gefunden.', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 // minHeight and deferEmptyText are needed to be able to show the |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 // emptyText message. |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 minHeight: 35, |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 deferEmptyText: false |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 }, |
125
324b11db4323
Store probeId as attribute of the "add" button in the zusatzwerte list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
123
diff
changeset
|
13 probeId: null, |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 initComponent: function() { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 this.dockedItems = [ |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 xtype: 'toolbar', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 dock: 'top', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 items: [ |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 text: 'Hinzufügen', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 icon: 'gfx/plus.gif', |
125
324b11db4323
Store probeId as attribute of the "add" button in the zusatzwerte list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
123
diff
changeset
|
23 action: 'add', |
324b11db4323
Store probeId as attribute of the "add" button in the zusatzwerte list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
123
diff
changeset
|
24 probeId: this.probeId |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 }, |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 text: 'Löschen', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 icon: 'gfx/minus.gif', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 action: 'delete' |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
30 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 ] |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
33 ]; |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 this.columns = [ |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
35 { |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
36 header: 'PZW-ID', |
136
4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
125
diff
changeset
|
37 dataIndex: 'pzsId' |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
38 }, |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
39 { |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
40 header: 'PZW-Größe', |
136
4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
125
diff
changeset
|
41 dataIndex: 'pzsId', |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
42 renderer: function(value) { |
136
4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
125
diff
changeset
|
43 var store = Ext.getStore('Probenzusatzwerte'); |
4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
125
diff
changeset
|
44 var record = store.getById(value); |
4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
125
diff
changeset
|
45 return record.get('beschreibung'); |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
46 }, |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
47 flex: 1 |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
48 }, |
140
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
49 { |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
50 header: 'Messwert', |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
51 dataIndex: 'pzsId', |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
52 renderer: function(value) { |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
53 var store = Ext.getStore('Zusatzwerte'); |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
54 var record = store.getById(value); |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
55 var messwert = record.get('messwertPzs'); |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
56 var nwg = record.get('nwgZuMesswert'); |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
57 if (messwert < nwg ) { |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
58 return "<"+messwert; |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
59 } else { |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
60 return messwert; |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
61 } |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
62 } |
00e43c00b7f2
Display messwert of Zusatzwert with a prepended "<" if the messwert is smaller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
136
diff
changeset
|
63 }, |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
64 {header: 'rel. Unsich.[%]', dataIndex: 'messfehler'}, |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
65 { |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
66 header: 'Maßeinheit', |
136
4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
125
diff
changeset
|
67 dataIndex: 'pzsId', |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
68 renderer: function(value) { |
141
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
140
diff
changeset
|
69 var zstore = Ext.getStore('Probenzusatzwerte'); |
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
140
diff
changeset
|
70 var mstore = Ext.getStore('Messeinheit'); |
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
140
diff
changeset
|
71 var mehId = zstore.getById(value).get('mehId'); |
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
140
diff
changeset
|
72 var record = mstore.findRecord('mehId', mehId); |
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
140
diff
changeset
|
73 return record.get('einheit'); |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
74 } |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
75 } |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
76 ]; |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
77 this.callParent(arguments); |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
78 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
79 }); |