changeset 100:8356595f4fdb

Changed store. Elements are in thate data attribute. Build custom id attribute.
author Torsten Irländer <torsten@irlaender.de>
date Mon, 17 Jun 2013 13:24:06 +0200
parents b6a05fe9f40e
children 551d08623f43
files app/model/Kommentar.js
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/app/model/Kommentar.js	Fri Jun 14 17:26:44 2013 +0200
+++ b/app/model/Kommentar.js	Mon Jun 17 13:24:06 2013 +0200
@@ -2,22 +2,25 @@
     extend: 'Ext.data.Model',
     fields: [
         {name: "id"},
-        {name: "kid"},
+        {name: "kid", mapping:"id.kid"},
+        {name: "convertedId", convert:buildId},
         {name: "probeId"},
         {name: "erzeuger"},
         {name: "kdatum"},
         {name: "ktext"}
     ],
-    // TODO: This id field is currently a combined field of probeId and kid
-    // which cases problems when generating a request with this id to the
-    // server.
-    idProperty: "id",
+    idProperty: "convertedId",
     proxy: {
         type: 'rest',
         appendId: true, //default
         url: 'server/rest/kommentare',
         reader: {
-            type: 'json'
+            type: 'json',
+            root: 'data'
         }
     }
 });
+
+function buildId(v, record){
+    return record.get('probeId') + record.get('kid');
+}

http://lada.wald.intevation.org