diff app/model/MKommentar.js @ 161:0b635b836903

Added model and store for Messungskommentare.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 03 Jul 2013 14:00:55 +0200
parents
children f1f0351b6e2f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/model/MKommentar.js	Wed Jul 03 14:00:55 2013 +0200
@@ -0,0 +1,32 @@
+Ext.define('Lada.model.MKommentar', {
+    extend: 'Ext.data.Model',
+    fields: [
+        {name: "kId"},
+        {name: "messungsId"},
+        {name: "probeId"},
+        {name: "erzeuger"},
+        {name: "kdatum", type: 'date', convert: ts2date, defaultValue: new Date()},
+        {name: "ktext"}
+    ],
+    idProperty: "kId",
+    proxy: {
+        type: 'rest',
+        appendId: true, //default
+        url: 'server/rest/messkommentare',
+        reader: {
+            type: 'json',
+            root: 'data'
+        }
+    },
+    getEidi: function() {
+        var kid =  this.get('kId');
+        var messId = this.get('messungsId');
+        var probeId = this.get('probeId');
+        return "/" + kid + "/" + messId + "/" + probeId;
+    }
+});
+
+function ts2date(v, record){
+    // Converts a timestamp into a date object.
+    return new Date(v);
+}

http://lada.wald.intevation.org