comparison app/model/Zusatzwert.js @ 114:189a93e31be9

Worked on Zusatzwerte. No all values are displayed correct in the List and form. But sending data in correct form does not work yet.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 20 Jun 2013 12:34:09 +0200
parents b91d5376db19
children a7bfaeb1655d
comparison
equal deleted inserted replaced
113:70f80c4ef90e 114:189a93e31be9
1 Ext.define('Lada.model.Zusatzwert', { 1 Ext.define('Lada.model.Zusatzwert', {
2 extend: 'Ext.data.Model', 2 extend: 'Ext.data.Model',
3 fields: [ 3 fields: [
4 {name: "id"}, 4 {name: "id"},
5 {name: "convertedId", convert:buildId},
6 {name: "probeId"}, 5 {name: "probeId"},
7 {name: "messwertNwg"}, 6 //{name: "pzsId", mapping: "id.pzsId"},
8 {name: "messwertPzs"},
9 {name: "messfehler"},
10 {name: "mehId"},
11 {name: "letzteAenderung"},
12 {name: "sprobenZusatz"}, 7 {name: "sprobenZusatz"},
13 {name: "pzsId"}, 8
14 {name: "beschreibung"}, 9 // Hier muss die tatsächliche Nachweisgrenze eingegeben werden.
15 {name: "zusatzwert"}, 10 {name: "nwgZuMesswert", type: 'float'},
16 {name: "eudfKeyword"} 11 {name: "messwertPzs", type: 'float'},
12 {name: "messfehler", type: 'float'},
13 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()},
14
15 // This are fields from the s_zusatzwert_table. They are currently not
16 // needed for displaying values in the grid.
17 {name: "sprobenZusatz_beschreibung", mapping: "sprobenZusatz.beschreibung"},
18 {name: "sprobenZusatz_pzsId", mapping: "sprobenZusatz.pzsId"},
19 {name: "sprobenZusatz_mehId", mapping: "sprobenZusatz.mehId"}
17 ], 20 ],
18 idProperty: "convertedId", 21 //// we can use the hasOne shortcut on the model to create a hasOne association
22 //associations: [{ type: 'hasOne', model: 'ProbenZusatzwert', foreignKey: 'pzsId'}],
23 idProperty: "id",
19 proxy: { 24 proxy: {
20 type: 'rest', 25 type: 'rest',
21 appendId: true, //default 26 appendId: true, //default
22 url: 'server/rest/zusatzwert', 27 url: 'server/rest/zusatzwert',
23 reader: { 28 reader: {
25 root: 'data' 30 root: 'data'
26 } 31 }
27 } 32 }
28 }); 33 });
29 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
30 function buildId(v, record){ 56 function buildId(v, record){
31 return record.get('probeId') + record.get('pzsId'); 57 return record.get('probeId') + ',' + record.get('pzsId');
32 } 58 }
59
60 function ts2date(v, record){
61 // Converts a timestamp into a date object.
62 return new Date(v);
63 }

http://lada.wald.intevation.org