Mercurial > lada > lada-client
annotate 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 |
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"}, |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
8 {name: "pzsId", mapping: "id.pzsId"}, |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
9 {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
|
10 {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
|
11 {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
|
12 {name: "messfehler", type: 'float'}, |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
13 {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
|
14 |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
15 //// This are fields from the s_zusatzwert_table. They are currently not |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
16 //// needed for displaying values in the grid. |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
17 //{name: "sprobenZusatz"}, |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
18 //{name: "sprobenZusatz_beschreibung", mapping: "sprobenZusatz.beschreibung"}, |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
19 //{name: "sprobenZusatz_pzsId", mapping: "sprobenZusatz.pzsId"}, |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
20 //{name: "sprobenZusatz_mehId", mapping: "sprobenZusatz.mehId"} |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 ], |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
22 hasOne: [ |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
23 { |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
24 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
|
25 primaryKey: 'pzsId', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
26 name: 'sprobenZusatz', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
27 associationKey: 'sprobenZusatz', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
28 foreignKey: 'pzsId', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
29 getterName: 'getProbenzusatz', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
30 setterName: 'setProbenzusatz' |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
31 } |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
32 ], |
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
|
33 idProperty: "id", |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 proxy: { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 type: 'rest', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 appendId: true, //default |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 url: 'server/rest/zusatzwert', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 reader: { |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 type: 'json', |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 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
|
41 }, |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
42 writer: { |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
43 type: 'json', |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
114
diff
changeset
|
44 writeEverything : true |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 } |
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 }); |
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 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
|
50 return record.get('probeId') + ',' + record.get('pzsId'); |
106
b91d5376db19
Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 } |
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
|
52 |
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 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
|
54 // 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
|
55 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
|
56 } |