diff app/view/form/Messung.js @ 961:6f1cc3316e2d

Intermediate Result. When creating a Messung a Statuswert will be set.
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Nov 2015 13:07:57 +0100
parents 73b397d8dd3a
children 6a6f2c6fe8ee
line wrap: on
line diff
--- a/app/view/form/Messung.js	Tue Nov 10 12:16:19 2015 +0100
+++ b/app/view/form/Messung.js	Tue Nov 10 13:07:57 2015 +0100
@@ -155,7 +155,7 @@
         var form = this.getForm();
         form.loadRecord(record);
         if (record.getId()){
-            this.retrieveStatus(record.id, record.get('status'));
+            this.retrieveStatus(record.getId(), record.get('status'));
         }
         else {
             //remove the StatusWert and StatusStufe field from the form
@@ -171,14 +171,16 @@
         var msg = i18n.getMsg('load.statuswert');
         var textfield = this.down('[name=status]');
 
-        textfield.setRawValue(msg);
+        if(textfield) {
+            textfield.setRawValue(msg);
+        }
 
-        var sStore = Ext.StoreManager.lookup('Status');
-        if (!sStore) {
-            sStore = Ext.create('Lada.store.Status');
-        }
-        sStore.on('load',
-            function(records, operation, success) {
+        var sStore = Ext.create('Lada.store.Status');
+        sStore.load({
+            params: {
+                messungsId: messungsId
+            },
+            callback: function(records, operation, success) {
                 var sw, ss;
                 var i18n = Lada.getApplication().bundle;
                 if (sStore.getTotalCount() === 0 || !statusId) {
@@ -191,11 +193,7 @@
                 this.setStatusWert(sw);
                 this.setStatusStufe(ss);
             },
-            this);
-        sStore.load({
-            params: {
-                messungsId: messungsId
-            }
+            scope: this
         });
     },
 
@@ -216,7 +214,9 @@
                         msg = item.get('wert');
                     }
                 }
-                textfield.setRawValue(msg);
+                if (textfield) {
+                    textfield.setRawValue(msg);
+                }
             },
         });
     },
@@ -238,7 +238,9 @@
                         msg = item.get('stufe');
                     }
                 }
-                textfield.setRawValue(msg);
+                if (textfield) {
+                    textfield.setRawValue(msg);
+                }
             },
         });
     },

http://lada.wald.intevation.org