changeset 959:841196768e86

Made kommentare-grids more robust
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Nov 2015 10:53:06 +0100
parents 5d57c6c53e20
children 73b397d8dd3a
files app/view/grid/MKommentar.js app/view/grid/PKommentar.js
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/grid/MKommentar.js	Tue Nov 10 09:50:06 2015 +0100
+++ b/app/view/grid/MKommentar.js	Tue Nov 10 10:53:06 2015 +0100
@@ -68,11 +68,16 @@
             header: 'Erzeuger',
             dataIndex: 'erzeuger',
             renderer: function(value) {
+                var r = '';
                 if (!value || value === '') {
-                    return '';
+                    r = 'Error';
                 }
-                var mstore = Ext.data.StoreManager.get('messstellen');
-                return mstore.getById(value).get('messStelle');
+                var store = Ext.data.StoreManager.get('messstellen');
+                var record = store.getById(value);
+                if (record) {
+                  r = record.get('messStelle');
+                }
+                return r;
             },
             editor: {
                 xtype: 'combobox',
--- a/app/view/grid/PKommentar.js	Tue Nov 10 09:50:06 2015 +0100
+++ b/app/view/grid/PKommentar.js	Tue Nov 10 10:53:06 2015 +0100
@@ -75,12 +75,16 @@
             dataIndex: 'erzeuger',
             width: 140,
             renderer: function(value) {
+                var r = '';
                 if (!value || value === '') {
-                    return '';
+                    r = 'Error';
                 }
                 var store = Ext.data.StoreManager.get('messstellen');
                 var record = store.getById(value);
-                return record.get('messStelle');
+                if (record) {
+                  r = record.get('messStelle');
+                }
+                return r;
             },
             editor: {
                 xtype: 'combobox',

http://lada.wald.intevation.org