[Lada-commits] [PATCH 2 of 5] Made the grids more robust against erroneous data

Wald Commits scm-commit at wald.intevation.org
Tue Nov 10 13:09:33 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1447145406 -3600
# Node ID 5d57c6c53e20ceabfa66541fbb18d190a6c6420d
# Parent  881984972e0e0c1e70424c2ccb30ce09c042dde6
Made the grids more robust against erroneous data

diff -r 881984972e0e -r 5d57c6c53e20 app/view/form/Messung.js
--- 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) {
diff -r 881984972e0e -r 5d57c6c53e20 app/view/grid/Status.js
--- 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: {


More information about the Lada-commits mailing list