annotate app/model/MKommentar.js @ 227:d3f4a39bf89e

Set IdProperty and fix creating and updating mkommentar
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 17 Jul 2013 10:58:03 +0200
parents 8970cbad6cae
children 7b30c20ad1aa
rev   line source
161
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.model.MKommentar', {
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 extend: 'Ext.data.Model',
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 fields: [
179
f1f0351b6e2f Show List of Messungskommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 161
diff changeset
4 {name: "id"},
227
d3f4a39bf89e Set IdProperty and fix creating and updating mkommentar
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 203
diff changeset
5 {name: "kid"},
161
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
6 {name: "messungsId"},
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
7 {name: "probeId"},
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
8 {name: "erzeuger"},
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 {name: "kdatum", type: 'date', convert: ts2date, defaultValue: new Date()},
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 {name: "ktext"}
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 ],
179
f1f0351b6e2f Show List of Messungskommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 161
diff changeset
12 idProperty: "id",
161
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 proxy: {
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 type: 'rest',
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 appendId: true, //default
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 url: 'server/rest/messkommentare',
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 reader: {
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 type: 'json',
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 root: 'data'
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 }
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 },
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
22 getEidi: function() {
227
d3f4a39bf89e Set IdProperty and fix creating and updating mkommentar
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 203
diff changeset
23 var kid = this.get('kid');
161
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 var messId = this.get('messungsId');
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 var probeId = this.get('probeId');
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 return "/" + kid + "/" + messId + "/" + probeId;
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 }
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 });
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
29
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 function ts2date(v, record){
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
31 // Converts a timestamp into a date object.
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 return new Date(v);
0b635b836903 Added model and store for Messungskommentare.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 }

http://lada.wald.intevation.org