comparison app/model/Kommentar.js @ 144:7b1140bd8b3d

Re-Added Kommentare
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 01 Jul 2013 10:15:00 +0200
parents 84f32c62670f
children 53a446d4f424
comparison
equal deleted inserted replaced
143:62b757ccdd8f 144:7b1140bd8b3d
1 Ext.define('Lada.model.Kommentar', { 1 Ext.define('Lada.model.Kommentar', {
2 extend: 'Ext.data.Model', 2 extend: 'Ext.data.Model',
3 fields: [ 3 fields: [
4 {name: "id"}, 4 {name: "kId"},
5 {name: "kid", mapping:"id.kid"},
6 {name: "convertedId", convert:buildId},
7 {name: "probeId"}, 5 {name: "probeId"},
8 {name: "erzeuger"}, 6 {name: "erzeuger"},
9 {name: "kdatum", type: 'date', convert: ts2date, defaultValue: new Date()}, 7 {name: "kdatum", type: 'date', convert: ts2date, defaultValue: new Date()},
10 {name: "ktext"} 8 {name: "ktext"}
11 ], 9 ],
12 idProperty: "convertedId", 10 idProperty: "kId",
13 proxy: { 11 proxy: {
14 type: 'rest', 12 type: 'rest',
15 appendId: true, //default 13 appendId: true, //default
16 url: 'server/rest/kommentare', 14 url: 'server/rest/kommentare',
17 reader: { 15 reader: {
18 type: 'json', 16 type: 'json',
19 root: 'data' 17 root: 'data'
20 } 18 }
19 },
20 getEidi: function() {
21 var kid = this.get('kId');
22 var probeId = this.get('probeId');
23 return "/" + kid + "/" + probeId;
21 } 24 }
22 }); 25 });
23
24 function buildId(v, record){
25 return record.get('probeId') + record.get('kid');
26 }
27 26
28 function ts2date(v, record){ 27 function ts2date(v, record){
29 // Converts a timestamp into a date object. 28 // Converts a timestamp into a date object.
30 return new Date(v); 29 return new Date(v);
31 } 30 }

http://lada.wald.intevation.org