Mercurial > lada > lada-client
comparison app/model/Zusatzwert.js @ 122:a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Fri, 21 Jun 2013 16:56:17 +0200 |
parents | 189a93e31be9 |
children | d78bb4ca6089 |
comparison
equal
deleted
inserted
replaced
121:c05fda928b82 | 122:a7bfaeb1655d |
---|---|
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 ], | |
3 fields: [ | 6 fields: [ |
4 {name: "id"}, | 7 {name: "id"}, |
5 {name: "probeId"}, | 8 {name: "pzsId", mapping: "id.pzsId"}, |
6 //{name: "pzsId", mapping: "id.pzsId"}, | 9 {name: "probeId", mapping: "id.probeId"}, |
7 {name: "sprobenZusatz"}, | |
8 | |
9 // Hier muss die tatsächliche Nachweisgrenze eingegeben werden. | |
10 {name: "nwgZuMesswert", type: 'float'}, | 10 {name: "nwgZuMesswert", type: 'float'}, |
11 {name: "messwertPzs", type: 'float'}, | 11 {name: "messwertPzs", type: 'float'}, |
12 {name: "messfehler", type: 'float'}, | 12 {name: "messfehler", type: 'float'}, |
13 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, | 13 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()} |
14 | 14 |
15 // This are fields from the s_zusatzwert_table. They are currently not | 15 //// This are fields from the s_zusatzwert_table. They are currently not |
16 // needed for displaying values in the grid. | 16 //// needed for displaying values in the grid. |
17 {name: "sprobenZusatz_beschreibung", mapping: "sprobenZusatz.beschreibung"}, | 17 //{name: "sprobenZusatz"}, |
18 {name: "sprobenZusatz_pzsId", mapping: "sprobenZusatz.pzsId"}, | 18 //{name: "sprobenZusatz_beschreibung", mapping: "sprobenZusatz.beschreibung"}, |
19 {name: "sprobenZusatz_mehId", mapping: "sprobenZusatz.mehId"} | 19 //{name: "sprobenZusatz_pzsId", mapping: "sprobenZusatz.pzsId"}, |
20 //{name: "sprobenZusatz_mehId", mapping: "sprobenZusatz.mehId"} | |
20 ], | 21 ], |
21 //// we can use the hasOne shortcut on the model to create a hasOne association | 22 hasOne: [ |
22 //associations: [{ type: 'hasOne', model: 'ProbenZusatzwert', foreignKey: 'pzsId'}], | 23 { |
24 model: 'Lada.model.Probenzusatzwert', | |
25 primaryKey: 'pzsId', | |
26 name: 'sprobenZusatz', | |
27 associationKey: 'sprobenZusatz', | |
28 foreignKey: 'pzsId', | |
29 getterName: 'getProbenzusatz', | |
30 setterName: 'setProbenzusatz' | |
31 } | |
32 ], | |
23 idProperty: "id", | 33 idProperty: "id", |
24 proxy: { | 34 proxy: { |
25 type: 'rest', | 35 type: 'rest', |
26 appendId: true, //default | 36 appendId: true, //default |
27 url: 'server/rest/zusatzwert', | 37 url: 'server/rest/zusatzwert', |
28 reader: { | 38 reader: { |
29 type: 'json', | 39 type: 'json', |
30 root: 'data' | 40 root: 'data' |
41 }, | |
42 writer: { | |
43 type: 'json', | |
44 writeEverything : true | |
31 } | 45 } |
32 } | 46 } |
33 }); | 47 }); |
34 | |
35 //Ext.define('Lada.model.ProbenZusatzwert', { | |
36 // extend: 'Ext.data.Model', | |
37 // fields: [ | |
38 // {name: "pzsId"}, | |
39 // {name: "medId"}, | |
40 // {name: "bschreibung"}, | |
41 // {name: "zusatzwert"}, | |
42 // {name: "eudfKeyword"} | |
43 // ], | |
44 // idProperty: "pzsId", | |
45 // proxy: { | |
46 // type: 'rest', | |
47 // appendId: true, //default | |
48 // url: 'server/rest/probenzusatzwert', | |
49 // reader: { | |
50 // type: 'json', | |
51 // root: 'data' | |
52 // } | |
53 // } | |
54 //}; | |
55 | 48 |
56 function buildId(v, record){ | 49 function buildId(v, record){ |
57 return record.get('probeId') + ',' + record.get('pzsId'); | 50 return record.get('probeId') + ',' + record.get('pzsId'); |
58 } | 51 } |
59 | 52 |