Mercurial > lada > lada-client
annotate app/model/Kommentar.js @ 164:767300b2c70f
Added custom renderer for "Anzahl Kommentare" column count the number of
comments for this messung.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 03 Jul 2013 14:03:51 +0200 |
parents | 7b1140bd8b3d |
children | 53a446d4f424 |
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: [ |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
4 {name: "kId"}, |
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
|
5 {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
|
6 {name: "erzeuger"}, |
107
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
7 {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
|
8 {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
|
9 ], |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
10 idProperty: "kId", |
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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 reader: { |
100
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
16 type: 'json', |
8356595f4fdb
Changed store. Elements are in thate data attribute. Build custom id
Torsten Irländer <torsten@irlaender.de>
parents:
62
diff
changeset
|
17 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
|
18 } |
144
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
19 }, |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
20 getEidi: function() { |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
21 var kid = this.get('kId'); |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
22 var probeId = this.get('probeId'); |
7b1140bd8b3d
Re-Added Kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
107
diff
changeset
|
23 return "/" + kid + "/" + probeId; |
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
|
24 } |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 }); |
100
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 function ts2date(v, record){ |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
28 // Converts a timestamp into a date object. |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
29 return new Date(v); |
84f32c62670f
Added form to create kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
100
diff
changeset
|
30 } |