annotate app/model/Zusatzwert.js @ 266:f005f43007b5

Fixed issue34. Erzeuger is now a selection field for messstelle.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 29 Jul 2013 14:44:17 +0200
parents dee9da79f055
children 51897f9a6bbb
rev   line source
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.model.Zusatzwert', {
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 extend: 'Ext.data.Model',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 fields: [
138
4287f29b5b81 Fixed fields in model (Forgotten broken mapping)
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 137
diff changeset
4 {name: "pzsId"},
4287f29b5b81 Fixed fields in model (Forgotten broken mapping)
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 137
diff changeset
5 {name: "probeId"},
114
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
6 {name: "nwgZuMesswert", type: 'float'},
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
7 {name: "messwertPzs", type: 'float'},
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
8 {name: "messfehler", type: 'float'},
136
4dc84682110d Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 131
diff changeset
9 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
10 ],
137
a7eea094d3d6 Removed id property from Zusatzwerte model. Do not set Probenzusatz when
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 136
diff changeset
11 idProperty: "pzsId",
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 proxy: {
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 type: 'rest',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 appendId: true, //default
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 url: 'server/rest/zusatzwert',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 reader: {
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 type: 'json',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 root: 'data'
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
19 },
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
20 writer: {
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
21 type: 'json',
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
22 writeEverything : true
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 }
131
968806c1a3cb Implement custom getEidi function to build a ID from the pzsId and the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 127
diff changeset
24 },
968806c1a3cb Implement custom getEidi function to build a ID from the pzsId and the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 127
diff changeset
25 getEidi: function () {
136
4dc84682110d Removed nested elements in Zusatzwerte. Change getting aditional info for
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 131
diff changeset
26 var pzsId = this.get('pzsId');
131
968806c1a3cb Implement custom getEidi function to build a ID from the pzsId and the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 127
diff changeset
27 var probeId = this.get('probeId');
968806c1a3cb Implement custom getEidi function to build a ID from the pzsId and the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 127
diff changeset
28 return "/" + pzsId + "/" + probeId;
142
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
29 },
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
30 getMesseinheit: function(pzsId) {
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
31 var zstore = Ext.getStore('Probenzusatzwerte');
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
32 var mstore = Ext.getStore('Messeinheit');
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
33 var mehId = zstore.getById(pzsId).get('mehId');
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
34 var record = mstore.findRecord('mehId', mehId);
dee9da79f055 Added function to model with return the beschreibung of the messeinheit of a
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 138
diff changeset
35 return record.get('einheit');
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
36 }
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 });
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 function buildId(v, record){
114
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
40 return record.get('probeId') + ',' + record.get('pzsId');
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 }
114
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
42
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
43 function ts2date(v, record){
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
44 // Converts a timestamp into a date object.
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
45 return new Date(v);
189a93e31be9 Worked on Zusatzwerte. No all values are displayed correct in the List and
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 106
diff changeset
46 }

http://lada.wald.intevation.org