changeset 710:f204f30b824a

Handle readonly mode and refresh operations.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 08 Apr 2015 10:50:33 +0200
parents 6f6d2df00130
children af16a257d5f6
files app/controller/form/Messung.js app/view/form/Messung.js app/view/window/MessungEdit.js app/view/window/ProbeEdit.js
diffstat 4 files changed, 25 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Messung.js	Tue Apr 07 17:16:59 2015 +0200
+++ b/app/controller/form/Messung.js	Wed Apr 08 10:50:33 2015 +0200
@@ -39,10 +39,18 @@
                     formPanel.clearMessages();
                     formPanel.setRecord(record);
                     formPanel.setMessages(json.errors, json.warnings);
+                    formPanel.up('window').initData();
                     formPanel.up('window').grid.store.reload();
+                    var parentWin = button.up('window').grid.up('window');
+                    parentWin.initData();
                     if (response.action === 'create' && json.success) {
-                        button.up('window').close();
+                        var oldWin = button.up('window');
+                        var probe = oldWin.record;
+                        oldWin.close();
                         var win = Ext.create('Lada.view.window.MessungEdit', {
+                            probe: probe,
+                            parentWindow: parentWin,
+                            grid: oldWin.grid,
                             record: record
                         });
                         win.show();
--- a/app/view/form/Messung.js	Tue Apr 07 17:16:59 2015 +0200
+++ b/app/view/form/Messung.js	Wed Apr 08 10:50:33 2015 +0200
@@ -168,10 +168,9 @@
 
     setReadOnly: function(value) {
         this.down('tfield[name=nebenprobenNr]').setReadOnly(value);
-        //this.down('messmethode[name=mmtId]').setReadOnly(value);
+        this.down('messmethode[name=mmtId]').setReadOnly(value);
         this.down('datetime[name=messzeitpunkt]').setReadOnly(value);
         this.down('numberfield[name=messdauer]').setReadOnly(value);
-        this.down('chkbox[name=fertig]').setReadOnly(value);
         this.down('chkbox[name=geplant]').setReadOnly(value);
     }
 });
--- a/app/view/window/MessungEdit.js	Tue Apr 07 17:16:59 2015 +0200
+++ b/app/view/window/MessungEdit.js	Wed Apr 08 10:50:33 2015 +0200
@@ -145,12 +145,15 @@
                 if (json) {
                     this.setMessages(json.errors, json.warnings);
                 }
+                if (this.record.get('readonly') === true) {
+                    this.disableForm();
+                }
+                else {
+                    this.enableForm();
+                }
             },
             scope: this
         });
-        if (this.record.get('readonly') == true){
-            this.disableForm();
-        }
     },
 
     disableForm: function(){
--- a/app/view/window/ProbeEdit.js	Tue Apr 07 17:16:59 2015 +0200
+++ b/app/view/window/ProbeEdit.js	Wed Apr 08 10:50:33 2015 +0200
@@ -140,15 +140,18 @@
                 if (json) {
                     this.setMessages(json.errors, json.warnings);
                 }
+                // If the Probe is ReadOnly, disable Inputfields and grids
+                if (this.record.get('readonly') === true) {
+                    this.down('probeform').setReadOnly(true);
+                    this.disableChildren();
+                }
+                else {
+                    this.down('probeform').setReadOnly(false);
+                    this.enableChildren();
+                }
             },
             scope: this
         });
-
-        // If the Probe is ReadOnly, disable Inputfields and grids
-        if (this.record.get('readonly') == true){
-            this.down('probeform').setReadOnly(true);
-            this.disableChildren();
-        }
     },
 
     enableAddMessungen: function(){

http://lada.wald.intevation.org