Mercurial > lada > lada-client
annotate app/model/Zusatzwert.js @ 127:f5864914ebb3
Commented out pzsId in Zusatzwert model.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 25 Jun 2013 11:26:21 +0200 |
parents | d78bb4ca6089 |
children | 968806c1a3cb |
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', |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
3 requires: [ |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
4 'Lada.model.Probenzusatzwert' |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
5 ], |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 fields: [ |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 {name: "id"}, |
127
f5864914ebb3
Commented out pzsId in Zusatzwert model.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
123
diff
changeset
|
8 // Commented out as pzsId must not be submitted to the server. On |
f5864914ebb3
Commented out pzsId in Zusatzwert model.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
123
diff
changeset
|
9 // serverside the pzsId is taken from the nested sprobenZusatz object. |
f5864914ebb3
Commented out pzsId in Zusatzwert model.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
123
diff
changeset
|
10 //{name: "pzsId", mapping: "id.pzsId"}, |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
11 {name: "probeId", mapping: "id.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
|
12 {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
|
13 {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
|
14 {name: "messfehler", type: 'float'}, |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
15 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, |
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
|
16 |
123
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
17 // Field for the nested Probenzusatzobject. This one is needed to have |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
18 // access to the nested data in the grid. |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
19 // TODO: I would have expected that this field does not need to be |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
20 // defined explicitly as there is the hasOne asscociation defined |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
21 // which name and associationKey named "sprobenZusatz". Anyway it does |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
22 // not seem to make problems. |
d78bb4ca6089
Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
23 {name: "sprobenZusatz"} |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 ], |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
25 hasOne: [ |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
26 { |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
27 model: 'Lada.model.Probenzusatzwert', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
28 primaryKey: 'pzsId', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
29 name: 'sprobenZusatz', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
30 associationKey: 'sprobenZusatz', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
31 foreignKey: 'pzsId', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
32 getterName: 'getProbenzusatz', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
33 setterName: 'setProbenzusatz' |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
34 } |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
35 ], |
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
|
36 idProperty: "id", |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 proxy: { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 type: 'rest', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 appendId: true, //default |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 url: 'server/rest/zusatzwert', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 reader: { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 type: 'json', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 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
|
44 }, |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
45 writer: { |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
46 type: 'json', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
47 writeEverything : true |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 }); |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 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
|
53 return record.get('probeId') + ',' + record.get('pzsId'); |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
54 } |
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
|
55 |
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
|
56 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
|
57 // 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
|
58 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
|
59 } |