[Lada-commits] [PATCH 1 of 4] Handle readonly mode and refresh operations

Wald Commits scm-commit at wald.intevation.org
Wed Apr 8 10:52:10 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1428483033 -7200
# Node ID f204f30b824a03bfeb7ef51a21276bb95b55fba4
# Parent  6f6d2df0013013a5fd08c1121442cc62b649ee35
Handle readonly mode and refresh operations.

diff -r 6f6d2df00130 -r f204f30b824a app/controller/form/Messung.js
--- 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();
diff -r 6f6d2df00130 -r f204f30b824a app/view/form/Messung.js
--- 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);
     }
 });
diff -r 6f6d2df00130 -r f204f30b824a app/view/window/MessungEdit.js
--- 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(){
diff -r 6f6d2df00130 -r f204f30b824a app/view/window/ProbeEdit.js
--- 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(){


More information about the Lada-commits mailing list