[Lada-commits] [PATCH 7 of 9] Show statusStufe in messunggrid

Wald Commits scm-commit at wald.intevation.org
Thu Mar 10 10:15:38 CET 2016


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1457536523 -3600
# Node ID 0497693d5b74855297d53f099506ebfb53bc2ea4
# Parent  4db4902d11c8a7b2d8d61aa699d214ea04ed8ae1
Show statusStufe in messunggrid.

diff -r 4db4902d11c8 -r 0497693d5b74 app/controller/grid/Status.js
--- 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){
diff -r 4db4902d11c8 -r 0497693d5b74 app/model/Messung.js
--- 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
     }, {
diff -r 4db4902d11c8 -r 0497693d5b74 app/view/grid/Messung.js
--- 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();
             }
         }


More information about the Lada-commits mailing list