diff app/controller/grid/Status.js @ 996:bf7bb9583a40

Statusworkflow: More work on the reset Button
author Dustin Demuth <dustin@intevation.de>
date Fri, 08 Jan 2016 14:34:27 +0100
parents 092e245b13a4
children 4bbb3da88c14
line wrap: on
line diff
--- a/app/controller/grid/Status.js	Thu Jan 07 16:20:48 2016 +0100
+++ b/app/controller/grid/Status.js	Fri Jan 08 14:34:27 2016 +0100
@@ -132,11 +132,13 @@
         var recentStatus = button.up('statusgrid').store.getById(s);
 
         //Set Status to 'Resetted' (8)
-        var record = recentStatus.copy();
-        record.set('datum', new Date());
-        record.set('statusWert', 8);
-        record.set('id', null);
-        record.set('text', null);
+        if (recentStatus) {
+            var record = recentStatus.copy();
+            record.set('datum', new Date());
+            record.set('statusWert', 8);
+            record.set('id', null);
+            record.set('text', null);
+        }
 
         Ext.Ajax.request({
             url: 'lada-server/status',
@@ -144,6 +146,7 @@
             method: 'POST',
             success: function(response) {
                 button.up('window').initData();
+                button.up('grid').initData();
             },
             failure: function(response) {
                 // TODO sophisticated error handling, with understandable Texts

http://lada.wald.intevation.org