changeset 958:5d57c6c53e20

Made the grids more robust against erroneous data
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Nov 2015 09:50:06 +0100
parents 881984972e0e
children 841196768e86
files app/view/form/Messung.js app/view/grid/Status.js
diffstat 2 files changed, 8 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/form/Messung.js	Mon Nov 09 14:13:27 2015 +0100
+++ b/app/view/form/Messung.js	Tue Nov 10 09:50:06 2015 +0100
@@ -193,10 +193,7 @@
      * Updates the Messungform and fills the Statuswert
      */
     setStatusWert: function(value){
-        var swStore = Ext.StoreManager.lookup('StatusWerte');
-        if (!swStore) {
-            var swStore = Ext.create('Lada.store.StatusWerte');
-        }
+        var swStore = Ext.create('Lada.store.StatusWerte');
         swStore.load({
             scope: this,
             callback: function(records, operation, success) {
@@ -218,10 +215,7 @@
      * Updates the Messungform and fills the StatusStufe
      */
     setStatusStufe: function(value){
-        var ssStore = Ext.StoreManager.lookup('StatusStufe');
-        if (!ssStore) {
-            var ssStore = Ext.create('Lada.store.StatusStufe');
-        }
+        var ssStore = Ext.create('Lada.store.StatusStufe');
         ssStore.load({
             scope: this,
             callback: function(records, operation, success) {
--- a/app/view/grid/Status.js	Mon Nov 09 14:13:27 2015 +0100
+++ b/app/view/grid/Status.js	Tue Nov 10 09:50:06 2015 +0100
@@ -47,9 +47,9 @@
         this.plugins = [this.rowEditing];
 
         var statusWerteStore = Ext.create('Lada.store.StatusWerte');
-        statusWerteStore.load();
+        statusWerteStore.load(); //add params messungid
         var statusStufeStore = Ext.create('Lada.store.StatusStufe');
-        statusStufeStore.load();
+        statusStufeStore.load(); //add params messungid
         this.dockedItems = [{
             xtype: 'toolbar',
             dock: 'bottom',
@@ -95,17 +95,14 @@
             header: 'Stufe',
             dataIndex: 'statusStufe',
             renderer: function(value) {
+                var r;
                 if (value===null || value === '') {
-                    return 'Fehlerhafte Daten';
+                    r = 'Error';
                 }
                 var item = statusStufeStore.getById(value);
-                var r;
                 if (item) {
                     r = item.get('stufe');
                 }
-                if (r === null) {
-                    r = 'Error';
-                }
                 return r;
             },
             editor: {
@@ -121,17 +118,14 @@
             header: 'Status',
             dataIndex: 'statusWert',
             renderer: function(value) {
+                var r;
                 if (value===null || value === '') {
-                    return '';
+                    r = 'Error';
                 }
                 var item = statusWerteStore.getById(value);
-                var r;
                 if (item) {
                     r = item.get('wert');
                 }
-                if (r === null) {
-                    r = 'Error';
-                }
                 return r;
             },
             editor: {

http://lada.wald.intevation.org