Mercurial > lada > lada-client
annotate app/model/Probe.js @ 115:fe4a1ee15418
Added conversion of datefield.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Thu, 20 Jun 2013 12:34:26 +0200 |
parents | e9643b7c103c |
children | 1907f405eb93 |
rev | line source |
---|---|
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.model.Probe', { |
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.data.Model', |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
3 fields: [ |
104
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
4 {name: "id", type: "string", convert: buildId}, |
50
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
5 {name: "probeId"}, |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
6 {name: "baId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
7 {name: "datenbasisId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
8 {name: "erzeugerId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
9 {name: "hauptprobenNr"}, |
99
b6a05fe9f40e
Setup missing fields in the proben overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
98
diff
changeset
|
10 {name: "messmethode"}, |
b6a05fe9f40e
Setup missing fields in the proben overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
98
diff
changeset
|
11 {name: "nebenprobenNr"}, |
b6a05fe9f40e
Setup missing fields in the proben overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
98
diff
changeset
|
12 {name: "bezeichnung"}, |
b6a05fe9f40e
Setup missing fields in the proben overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
98
diff
changeset
|
13 {name: "kreis"}, |
115
fe4a1ee15418
Added conversion of datefield.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
104
diff
changeset
|
14 {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
15 {name: "media"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
16 {name: "mediaDesk"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
17 {name: "mittelungsdauer"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
18 {name: "mpKat"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
19 {name: "mplId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
20 {name: "mprId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
21 {name: "mstId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
22 {name: "netzbetreiberId"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
23 {name: "probeNehmerId"}, |
77
c846a2e37289
Set default date in Proben to today.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
24 {name: "probeentnahmeBeginn", type: 'date', convert: ts2date, defaultValue: new Date()}, |
c846a2e37289
Set default date in Proben to today.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
25 {name: "probeentnahmeEnde", type: 'date', convert: ts2date, defaultValue: new Date()}, |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
26 {name: "probenartId"}, |
77
c846a2e37289
Set default date in Proben to today.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
27 {name: "solldatumBeginn", type: 'date', convert: ts2date, defaultValue: new Date()}, |
c846a2e37289
Set default date in Proben to today.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
28 {name: "solldatumEnde", type: 'date', convert: ts2date, defaultValue: new Date()}, |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
29 {name: "test"}, |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
30 {name: "umwId"} |
50
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
31 ], |
104
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
32 idProperty: "id", |
50
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
33 proxy: { |
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
34 type: 'rest', |
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
35 appendId: true, //default |
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
36 url: 'server/rest/proben', |
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
37 reader: { |
77
c846a2e37289
Set default date in Proben to today.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
38 type: 'json', |
c846a2e37289
Set default date in Proben to today.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
39 root: 'data' |
50
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
40 } |
2fbd53b944fc
Move proxy definition into the model. Else the building of the URL does not
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
21
diff
changeset
|
41 } |
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 }); |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
43 |
104
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
44 function buildId(v, record){ |
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
45 var newId = record.get('probeId') + record.get('nebenprobenNr'); |
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
46 return newId; |
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
47 } |
e9643b7c103c
[mq]: craftid
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
48 |
21
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
49 function ts2date(v, record){ |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
50 // Converts a timestamp into a date object. |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
51 return new Date(v); |
4caf4c8c694a
Added more fields to the probenclass
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
52 } |