diff app/view/grid/Status.js @ 990:c2a726887dd7

The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
author Dustin Demuth <dustin@intevation.de>
date Wed, 16 Dec 2015 09:49:09 +0100
parents d4603049cd42
children 092e245b13a4
line wrap: on
line diff
--- a/app/view/grid/Status.js	Tue Dec 15 08:50:49 2015 +0100
+++ b/app/view/grid/Status.js	Wed Dec 16 09:49:09 2015 +0100
@@ -37,8 +37,22 @@
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
             autoCancel: false,
-            disabled: true,
-            pluginId: 'rowedit'
+            disabled: true, //has no effect... but why?
+            pluginId: 'rowedit',
+            listeners: {
+                beforeedit: function(editor, context, eOpts) {
+                    if (context.record.get('id') ||
+                        ! context.grid.up('window').record.get('statusEdit')) {
+                    //Check if edit is allowed, this is true, when the selected
+                    // Record has an id (=is not new)
+                    // or is not allowed to add records.
+
+                        return false;
+                    }
+
+
+                }
+            }
         });
         this.plugins = [this.rowEditing];
 
@@ -147,11 +161,16 @@
             this.store.removeAll();
         }
         else {
-            this.store = Ext.create('Lada.store.Status');
+            this.store = Ext.create('Lada.store.Status',{
+                sorters: [{
+                    property: 'datum',
+                    direction: 'ASC'
+                }]
+            });
         }
         this.store.load({
             params: {
-                messungsId: this.recordId
+                messungsId: this.recordId,
             }
         });
     },

http://lada.wald.intevation.org