annotate app/model/Messung.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 92facbaece42
children fe199b8828a8
rev   line source
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
1 Ext.define('Lada.model.Messung', {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
2 extend: 'Ext.data.Model',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
3 fields: [
162
5eb0cfac0e30 Added nested id attribute which comes in JSON response to the model as we need
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 159
diff changeset
4 {name: "id"},
159
f653bd7893c0 Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 158
diff changeset
5 {name: "messungsId", mapping:"id.messungsId"},
f653bd7893c0 Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 158
diff changeset
6 {name: "probeId", mapping:"id.probeId"},
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
7 {name: "mmtId"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
8 {name: "nebenprobenNr"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
9 {name: "messdauer"},
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
10 {name: "messzeitpunkt", convert: ts2date, defaultValue: new Date()},
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
11 {name: "fertig", type: "boolean"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
12 {name: "letzteAenderung", type:"date"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
13 {name: "geplant", type: "boolean"}
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
14 ],
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
15 idProperty: "id",
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
16 proxy: {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
17 type: 'rest',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
18 appendId: true, //default
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
19 url: 'server/rest/messung',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
20 reader: {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
21 type: 'json',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
22 root: 'data'
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
23 }
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
24 },
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
25 getEidi: function() {
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
26 var messId = this.get('messungsId');
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
27 var probeId = this.get('probeId');
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
28 return "/" + messId + "/" + probeId;
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
29 }
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
30 });
171
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
31
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
32 function ts2date(v, record){
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
33 // Converts a timestamp into a date object.
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
34 return new Date(v);
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
35 }

http://lada.wald.intevation.org