changeset 1062:0497693d5b74

Show statusStufe in messunggrid.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 09 Mar 2016 16:15:23 +0100
parents 4db4902d11c8
children 4654b788f3d4
files app/controller/grid/Status.js app/model/Messung.js app/view/grid/Messung.js
diffstat 3 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/Status.js	Wed Mar 09 15:39:04 2016 +0100
+++ b/app/controller/grid/Status.js	Wed Mar 09 16:15:23 2016 +0100
@@ -121,7 +121,6 @@
         // Do not copy, if current userid differs from the id of the current status
         if (lastrow > 0 &&
                 Ext.Array.contains(Lada.mst, recentStatus.get('erzeuger'))) {
-
             if (recentStatus) {
                 // clone the status
                 var record = recentStatus.copy()
@@ -207,12 +206,18 @@
                     }
                 }
 
-                button.up('window').initData();
+                var win = button.up('window');
+                win.initData();
                 button.up('grid').initData();
+                try {
+                    win.parentWindow.initData();
+                    win.parentWindow.down('messunggrid').store.reload();
+                }
+                catch(e) {
+                }
             },
             failure: function(response) {
                 // TODO sophisticated error handling, with understandable Texts
-                var i18n = Lada.getApplication().bundle;
                 var json = Ext.JSON.decode(response.responseText);
                 if (json) {
                     if(json.message){
--- a/app/model/Messung.js	Wed Mar 09 15:39:04 2016 +0100
+++ b/app/model/Messung.js	Wed Mar 09 16:15:23 2016 +0100
@@ -80,6 +80,9 @@
         name: 'statusWert',
         persist: false
     }, {
+        name: 'statusStufe',
+        persist: false
+    }, {
         name: 'messwerteCount',
         persist: false
     }, {
--- a/app/view/grid/Messung.js	Wed Mar 09 15:39:04 2016 +0100
+++ b/app/view/grid/Messung.js	Wed Mar 09 16:15:23 2016 +0100
@@ -89,6 +89,23 @@
                 return sta.getById(value).get('wert');
             }
         }, {
+            header: 'Stufe',
+            flex: 1,
+            dataIndex: 'statusStufe',
+            renderer: function(value, meta, record, rNdx, cNdx) {
+                var statusId = record.get('status');
+                var mId = record.get('id');
+                //also fwd the record to the asynchronous loading of statuswerte
+                // in order to add the statuswert to the record,
+                // after the grid was rendered...
+                if (value === '') {
+                    this.updateStatus(mId, statusId, record);
+                    return 'Lade...';
+                }
+                var sta = Ext.data.StoreManager.getByKey('statusstufe');
+                return sta.getById(value).get('stufe');
+            }
+        }, {
             header: 'OK-Flag',
             dataIndex: 'fertig',
             flex: 1,
@@ -232,11 +249,13 @@
             var rec = sstore.getById(opts.statusId);
             if (rec) {
                 value = rec.get('statusWert');
+                var stufe = rec.get('statusStufe');
                 //add the determined statuswert to the record.
                 // this is necessary to let the controller determine
                 // which actions are allowed.
                 opts.record.beginEdit();
                 opts.record.set('statusWert', value);
+                opts.record.set('statusStufe', stufe);
                 opts.record.endEdit();
             }
         }

http://lada.wald.intevation.org