comparison app/model/Zusatzwert.js @ 136:4dc84682110d

Removed nested elements in Zusatzwerte. Change getting aditional info for Probenzusätze in the Zusatzwert listing.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 26 Jun 2013 10:18:08 +0200
parents 968806c1a3cb
children a7eea094d3d6
comparison
equal deleted inserted replaced
135:e80a9114524c 136:4dc84682110d
1 Ext.define('Lada.model.Zusatzwert', { 1 Ext.define('Lada.model.Zusatzwert', {
2 extend: 'Ext.data.Model', 2 extend: 'Ext.data.Model',
3 requires: [
4 'Lada.model.Probenzusatzwert'
5 ],
6 fields: [ 3 fields: [
7 {name: "id"}, 4 {name: "id"},
8 // Commented out as pzsId must not be submitted to the server. On 5 {name: "pzsId", mapping: "id.pzsId"},
9 // serverside the pzsId is taken from the nested sprobenZusatz object.
10 //{name: "pzsId", mapping: "id.pzsId"},
11 {name: "probeId", mapping: "id.probeId"}, 6 {name: "probeId", mapping: "id.probeId"},
12 {name: "nwgZuMesswert", type: 'float'}, 7 {name: "nwgZuMesswert", type: 'float'},
13 {name: "messwertPzs", type: 'float'}, 8 {name: "messwertPzs", type: 'float'},
14 {name: "messfehler", type: 'float'}, 9 {name: "messfehler", type: 'float'},
15 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, 10 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}
16
17 // Field for the nested Probenzusatzobject. This one is needed to have
18 // access to the nested data in the grid.
19 // TODO: I would have expected that this field does not need to be
20 // defined explicitly as there is the hasOne asscociation defined
21 // which name and associationKey named "sprobenZusatz". Anyway it does
22 // not seem to make problems.
23 {name: "sprobenZusatz"}
24 ],
25 hasOne: [
26 {
27 model: 'Lada.model.Probenzusatzwert',
28 primaryKey: 'pzsId',
29 name: 'sprobenZusatz',
30 associationKey: 'sprobenZusatz',
31 foreignKey: 'pzsId',
32 getterName: 'getProbenzusatz',
33 setterName: 'setProbenzusatz'
34 }
35 ], 11 ],
36 idProperty: "id", 12 idProperty: "id",
37 proxy: { 13 proxy: {
38 type: 'rest', 14 type: 'rest',
39 appendId: true, //default 15 appendId: true, //default
46 type: 'json', 22 type: 'json',
47 writeEverything : true 23 writeEverything : true
48 } 24 }
49 }, 25 },
50 getEidi: function () { 26 getEidi: function () {
51 var sprobenZusatz = this.get('sprobenZusatz'); 27 var pzsId = this.get('pzsId');
52 var pzsId = sprobenZusatz.pzsId;
53 var probeId = this.get('probeId'); 28 var probeId = this.get('probeId');
54 return "/" + pzsId + "/" + probeId; 29 return "/" + pzsId + "/" + probeId;
55 } 30 }
56 }); 31 });
57 32

http://lada.wald.intevation.org