annotate app/model/Messung.js @ 333:6964cd97d35f

Inherit form model.base. Formatting
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 13 Aug 2013 08:54:25 +0200
parents 63eae13768f3
children debfcc7713e3
rev   line source
314
65f8be677c8a Added docstring
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 299
diff changeset
1 /**
65f8be677c8a Added docstring
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 299
diff changeset
2 * Model class for Messungen
65f8be677c8a Added docstring
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 299
diff changeset
3 */
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
4 Ext.define('Lada.model.Messung', {
327
63eae13768f3 Inherit form model.base. Formatting
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 314
diff changeset
5 extend: 'Lada.model.Base',
63eae13768f3 Inherit form model.base. Formatting
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 314
diff changeset
6 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
7 {name: "id"},
159
f653bd7893c0 Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 158
diff changeset
8 {name: "messungsId", mapping:"id.messungsId"},
f653bd7893c0 Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 158
diff changeset
9 {name: "probeId", mapping:"id.probeId"},
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
10 {name: "mmtId"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
11 {name: "nebenprobenNr"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
12 {name: "messdauer"},
299
fe199b8828a8 Use ts2date function from lib.Helpers. Remove old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 212
diff changeset
13 {name: "messzeitpunkt", convert: Lada.lib.Helpers.ts2date, defaultValue: new Date()},
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
14 {name: "fertig", type: "boolean"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
15 {name: "letzteAenderung", type:"date"},
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
16 {name: "geplant", type: "boolean"}
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
17 ],
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
18 idProperty: "id",
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
19 proxy: {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
20 type: 'rest',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
21 appendId: true, //default
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
22 url: 'server/rest/messung',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
23 reader: {
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
24 type: 'json',
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
25 root: 'data'
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
26 }
212
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
27 },
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
28 getEidi: function() {
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
29 var messId = this.get('messungsId');
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
30 var probeId = this.get('probeId');
92facbaece42 add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 171
diff changeset
31 return "/" + messId + "/" + probeId;
103
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
32 }
3552b0ee4526 Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff changeset
33 });
171
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
34
c5422819d7b9 Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 162
diff changeset
35 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
36 // 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
37 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
38 }

http://lada.wald.intevation.org