[Lada-commits] [PATCH 2 of 2] Removed nested elements in Zusatzwerte. Change getting aditional info for

Wald Commits scm-commit at wald.intevation.org
Wed Jun 26 10:19:01 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1372234688 -7200
# Node ID 4dc84682110d9ad085ec886b4ec8a2fc08637ba4
# Parent  e80a9114524cbb6758b7cfc75b676be1616dba8b
Removed nested elements in Zusatzwerte. Change getting aditional info for
Probenzusätze in the Zusatzwert listing.

diff -r e80a9114524c -r 4dc84682110d app/model/Zusatzwert.js
--- a/app/model/Zusatzwert.js	Wed Jun 26 10:16:10 2013 +0200
+++ b/app/model/Zusatzwert.js	Wed Jun 26 10:18:08 2013 +0200
@@ -1,37 +1,13 @@
 Ext.define('Lada.model.Zusatzwert', {
     extend: 'Ext.data.Model',
-    requires: [
-        'Lada.model.Probenzusatzwert'
-    ],
     fields: [
         {name: "id"},
-        // Commented out as pzsId must not be submitted to the server. On
-        // serverside the pzsId is taken from the nested sprobenZusatz object.
-        //{name: "pzsId", mapping: "id.pzsId"},
+        {name: "pzsId", mapping: "id.pzsId"},
         {name: "probeId", mapping: "id.probeId"},
         {name: "nwgZuMesswert", type: 'float'},
         {name: "messwertPzs", type: 'float'},
         {name: "messfehler", type: 'float'},
-        {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()},
-
-        // Field for the nested Probenzusatzobject. This one is needed to have
-        // access to the nested data in the grid.
-        // TODO: I would have expected that this field does not need to be
-        // defined explicitly as there is the hasOne asscociation defined
-        // which name and associationKey named "sprobenZusatz". Anyway it does
-        // not seem to make problems.
-        {name: "sprobenZusatz"}
-    ],
-    hasOne: [
-        {
-            model: 'Lada.model.Probenzusatzwert',
-            primaryKey: 'pzsId',
-            name: 'sprobenZusatz',
-            associationKey: 'sprobenZusatz',
-            foreignKey: 'pzsId',
-            getterName: 'getProbenzusatz',
-            setterName: 'setProbenzusatz'
-        }
+        {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}
     ],
     idProperty: "id",
     proxy: {
@@ -48,8 +24,7 @@
         }
     },
     getEidi: function () {
-        var sprobenZusatz = this.get('sprobenZusatz');
-        var pzsId =  sprobenZusatz.pzsId;
+        var pzsId =  this.get('pzsId');
         var probeId = this.get('probeId');
         return "/" + pzsId + "/" + probeId;
     }
diff -r e80a9114524c -r 4dc84682110d app/view/zusatzwerte/List.js
--- a/app/view/zusatzwerte/List.js	Wed Jun 26 10:16:10 2013 +0200
+++ b/app/view/zusatzwerte/List.js	Wed Jun 26 10:18:08 2013 +0200
@@ -34,16 +34,15 @@
         this.columns = [
             {
                 header: 'PZW-ID',
-                dataIndex: 'sprobenZusatz',
-                renderer: function(value) {
-                    return value.pzsId;
-                }
+                dataIndex: 'pzsId'
             },
             {
                 header: 'PZW-Größe',
-                dataIndex: 'sprobenZusatz',
+                dataIndex: 'pzsId',
                 renderer: function(value) {
-                    return value.beschreibung;
+                    var store = Ext.getStore('Probenzusatzwerte');
+                    var record = store.getById(value);
+                    return record.get('beschreibung');
                 },
                 flex: 1
             },
@@ -51,9 +50,11 @@
             {header: 'rel. Unsich.[%]', dataIndex: 'messfehler'},
             {
                 header: 'Maßeinheit',
-                dataIndex: 'sprobenZusatz',
+                dataIndex: 'pzsId',
                 renderer: function(value) {
-                    return value.mehId;
+                    var store = Ext.getStore('Probenzusatzwerte');
+                    var record = store.getById(value);
+                    return record.get('mehId');
                 }
             }
         ];


More information about the Lada-commits mailing list