diff app/model/Zusatzwert.js @ 114:189a93e31be9

Worked on Zusatzwerte. No all values are displayed correct in the List and form. But sending data in correct form does not work yet.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 20 Jun 2013 12:34:09 +0200
parents b91d5376db19
children a7bfaeb1655d
line wrap: on
line diff
--- a/app/model/Zusatzwert.js	Wed Jun 19 15:56:17 2013 +0200
+++ b/app/model/Zusatzwert.js	Thu Jun 20 12:34:09 2013 +0200
@@ -2,20 +2,25 @@
     extend: 'Ext.data.Model',
     fields: [
         {name: "id"},
-        {name: "convertedId", convert:buildId},
         {name: "probeId"},
-        {name: "messwertNwg"},
-        {name: "messwertPzs"},
-        {name: "messfehler"},
-        {name: "mehId"},
-        {name: "letzteAenderung"},
+        //{name: "pzsId", mapping: "id.pzsId"},
         {name: "sprobenZusatz"},
-        {name: "pzsId"},
-        {name: "beschreibung"},
-        {name: "zusatzwert"},
-        {name: "eudfKeyword"}
+
+        // Hier muss die tatsächliche Nachweisgrenze eingegeben werden.
+        {name: "nwgZuMesswert", type: 'float'},
+        {name: "messwertPzs", type: 'float'},
+        {name: "messfehler", type: 'float'},
+        {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()},
+
+        // This are fields from the s_zusatzwert_table. They are currently not
+        // needed for displaying values in the grid.
+        {name: "sprobenZusatz_beschreibung", mapping: "sprobenZusatz.beschreibung"},
+        {name: "sprobenZusatz_pzsId", mapping: "sprobenZusatz.pzsId"},
+        {name: "sprobenZusatz_mehId", mapping: "sprobenZusatz.mehId"}
     ],
-    idProperty: "convertedId",
+    //// we can use the hasOne shortcut on the model to create a hasOne association
+    //associations: [{ type: 'hasOne', model: 'ProbenZusatzwert', foreignKey: 'pzsId'}],
+    idProperty: "id",
     proxy: {
         type: 'rest',
         appendId: true, //default
@@ -27,6 +32,32 @@
     }
 });
 
+//Ext.define('Lada.model.ProbenZusatzwert', {
+//    extend: 'Ext.data.Model',
+//    fields: [
+//        {name: "pzsId"},
+//        {name: "medId"},
+//        {name: "bschreibung"},
+//        {name: "zusatzwert"},
+//        {name: "eudfKeyword"}
+//    ],
+//    idProperty: "pzsId",
+//    proxy: {
+//        type: 'rest',
+//        appendId: true, //default
+//        url: 'server/rest/probenzusatzwert',
+//        reader: {
+//            type: 'json',
+//            root: 'data'
+//        }
+//    }
+//};
+
 function buildId(v, record){
-    return record.get('probeId') + record.get('pzsId');
+    return record.get('probeId') + ',' + record.get('pzsId');
 }
+
+function ts2date(v, record){
+    // Converts a timestamp into a date object.
+    return new Date(v);
+}

http://lada.wald.intevation.org