[Lada-commits] [PATCH 2 of 5] Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas

Wald Commits scm-commit at wald.intevation.org
Thu Nov 12 16:15:49 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1447334707 -3600
# Node ID a2c2039bb5d906de3ef2ced48c08e184eaad8279
# Parent  5b86baa038bc3e29339635a8cb68b8b569238ee6
Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas

diff -r 5b86baa038bc -r a2c2039bb5d9 app.js
--- a/app.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app.js	Thu Nov 12 14:25:07 2015 +0100
@@ -157,10 +157,12 @@
             storeId: 'verwaltungseinheiten'
         });
         Ext.create('Lada.store.StatusWerte', {
-            storeId: 'statuswerte'
+            storeId: 'statuswerte',
+            autoLoad: true
         });
         Ext.create('Lada.store.StatusStufe', {
-            storeId: 'statusstufe'
+            storeId: 'statusstufe',
+            autoLoad: 'true'
         });
     },
 
diff -r 5b86baa038bc -r a2c2039bb5d9 app/controller/grid/Status.js
--- a/app/controller/grid/Status.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/controller/grid/Status.js	Thu Nov 12 14:25:07 2015 +0100
@@ -94,6 +94,7 @@
 
         //retrieve the readOnly parameters
         var readonlyWin = context.view.up('window').record.get('readonly');
+        //var statusEdit = context.view.up('window').record.get('statusEdit');
 
         var readonlyRec = record.get('readonly');
         var grid = context.view.up('grid');
diff -r 5b86baa038bc -r a2c2039bb5d9 app/model/Messung.js
--- a/app/model/Messung.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/model/Messung.js	Thu Nov 12 14:25:07 2015 +0100
@@ -22,6 +22,10 @@
         type: 'boolean',
         persist: false
     }, {
+        name: 'statusEdit',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'probeId'
     }, {
         name: 'mmtId'
@@ -39,7 +43,7 @@
         },
         defaultValue: new Date()
     }, {
-        name: 'status',
+        name: 'status'
     }, {
         name: 'fertig',
         type: 'boolean'
diff -r 5b86baa038bc -r a2c2039bb5d9 app/model/Status.js
--- a/app/model/Status.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/model/Status.js	Thu Nov 12 14:25:07 2015 +0100
@@ -20,7 +20,7 @@
         persist: false
     }, {
         name: 'owner',
-        type: 'boolean',
+        type: 'boolean'
     }, {
         name: 'messungsId'
     }, {
diff -r 5b86baa038bc -r a2c2039bb5d9 app/store/StatusStufe.js
--- a/app/store/StatusStufe.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/store/StatusStufe.js	Thu Nov 12 14:25:07 2015 +0100
@@ -12,6 +12,6 @@
 Ext.define('Lada.store.StatusStufe', {
     extend: 'Ext.data.Store',
     model: 'Lada.model.StatusStufe',
-    autoLoad: true,
+    autoLoad: false
 });
 
diff -r 5b86baa038bc -r a2c2039bb5d9 app/store/StatusWerte.js
--- a/app/store/StatusWerte.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/store/StatusWerte.js	Thu Nov 12 14:25:07 2015 +0100
@@ -12,5 +12,5 @@
 Ext.define('Lada.store.StatusWerte', {
     extend: 'Ext.data.Store',
     model: 'Lada.model.StatusWerte',
-    autoLoad: true,
+    autoLoad: false
 });
diff -r 5b86baa038bc -r a2c2039bb5d9 app/view/form/Messung.js
--- a/app/view/form/Messung.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/form/Messung.js	Thu Nov 12 14:25:07 2015 +0100
@@ -128,7 +128,7 @@
                     preventMark: true, //Do not display error msg.
                     validateValue: function() {
                         return true; //this field is always valid
-                    },
+                    }
                 }, {
                     xtype: 'textfield',
                     name: 'stufe',
@@ -144,7 +144,7 @@
                     preventMark: true, //Do not display error msg.
                     validateValue: function() {
                         return true; //this field is always valid
-                    },
+                    }
                 }]
             }]
         }];
@@ -209,6 +209,7 @@
         if (!swStore) {
             //Set the textfield asynchronously
             swStore = Ext.create('Lada.store.StatusWerte');
+            console.log('loading sw store messungform');
             swStore.load({
                 scope: this,
                 callback: function(records, operation, success) {
@@ -221,7 +222,7 @@
                     if (textfield) {
                         textfield.setRawValue(msg);
                     }
-                },
+                }
             });
         }
         else {
@@ -260,7 +261,7 @@
                     if (textfield) {
                         textfield.setRawValue(msg);
                     }
-                },
+                }
             });
         }
         else {
diff -r 5b86baa038bc -r a2c2039bb5d9 app/view/grid/Status.js
--- a/app/view/grid/Status.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/grid/Status.js	Thu Nov 12 14:25:07 2015 +0100
@@ -72,7 +72,7 @@
             xtype: 'datecolumn',
             format: 'd.m.Y H:i',
             width: 110,
-            sortable: false,
+            sortable: false
         }, {
             header: 'Erzeuger',
             dataIndex: 'erzeuger',
@@ -96,7 +96,7 @@
                 allowBlank: false,
                 editable: false
             },
-            sortable: false,
+            sortable: false
         }, {
             header: 'Stufe',
             dataIndex: 'statusStufe',
@@ -112,7 +112,7 @@
                 }
                 return r;
             },
-            sortable: false,
+            sortable: false
         }, {
             header: 'Status',
             dataIndex: 'statusWert',
@@ -137,7 +137,7 @@
                 allowBlank: false,
                 editable: false
             },
-            sortable: false,
+            sortable: false
         }, {
             header: 'Text',
             dataIndex: 'text',
@@ -147,7 +147,7 @@
                 maxLength: 1000,
                 enforceMaxLength: true
             },
-            sortable: false,
+            sortable: false
         }];
         this.initData();
         this.callParent(arguments);
diff -r 5b86baa038bc -r a2c2039bb5d9 app/view/window/MessungEdit.js
--- a/app/view/window/MessungEdit.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/window/MessungEdit.js	Thu Nov 12 14:25:07 2015 +0100
@@ -171,6 +171,13 @@
                 else {
                     this.enableForm();
                 }
+                //Check if it is allowed to edit Status
+                if (this.record.get('statusEdit') === true) {
+                    this.enableStatusEdit();
+                }
+                else {
+                    this.disableStatusEdit();
+                }
             },
             scope: this
         });
@@ -200,10 +207,9 @@
     disableChildren: function() {
             this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true);
             this.down('fset[name=messwerte]').down('messwertgrid').readOnly = true;
-            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
-            this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
             this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
             this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true;
+            this.disableStatusEdit();
     },
 
     /**
@@ -212,11 +218,26 @@
     enableChildren: function() {
             this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false);
             this.down('fset[name=messwerte]').down('messwertgrid').readOnly = false;
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
+            this.enableStatusEdit();
+    },
+
+    /**
+     * Enable to edit the statusgrid
+     */
+     enableStatusEdit: function () {
             this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
             this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false;
-            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
-            this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
-    },
+     },
+
+    /**
+     * Disable to edit the statusgrid
+     */
+     disableStatusEdit: function () {
+            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
+            this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
+     },
 
     /**
      * Instructs the fields / forms listed in this method to set a message.


More information about the Lada-commits mailing list