Mercurial > lada > lada-client
annotate app/model/Kommentar.js @ 131:968806c1a3cb
Implement custom getEidi function to build a ID from the pzsId and the
probenID.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 25 Jun 2013 17:30:01 +0200 |
parents | 84f32c62670f |
children | 7b1140bd8b3d |
rev | line source |
---|---|
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.model.Kommentar', { |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.data.Model', |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 fields: [ |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 {name: "id"}, |
100
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
5 {name: "kid", mapping:"id.kid"}, |
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
6 {name: "convertedId", convert:buildId}, |
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 {name: "probeId"}, |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 {name: "erzeuger"}, |
107
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
9 {name: "kdatum", type: 'date', convert: ts2date, defaultValue: new Date()}, |
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 {name: "ktext"} |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 ], |
100
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
12 idProperty: "convertedId", |
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 proxy: { |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 type: 'rest', |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 appendId: true, //default |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 url: 'server/rest/kommentare', |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 reader: { |
100
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
18 type: 'json', |
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
19 root: 'data' |
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 } |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 } |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 }); |
100
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
23 |
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
24 function buildId(v, record){ |
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
25 return record.get('probeId') + record.get('kid'); |
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
26 } |
107
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
27 |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
28 function ts2date(v, record){ |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
29 // Converts a timestamp into a date object. |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
30 return new Date(v); |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
31 } |