diff app/controller/grid/Status.js @ 969:d4603049cd42

Fixed edit status. Only the last record is editable.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 12 Nov 2015 17:38:57 +0100
parents a2c2039bb5d9
children f4eb53ba63fc
line wrap: on
line diff
--- a/app/controller/grid/Status.js	Thu Nov 12 16:15:37 2015 +0100
+++ b/app/controller/grid/Status.js	Thu Nov 12 17:38:57 2015 +0100
@@ -93,23 +93,17 @@
     toggleAllowedPermissions: function(context, record, index){
 
         //retrieve the readOnly parameters
-        var readonlyWin = context.view.up('window').record.get('readonly');
-        //var statusEdit = context.view.up('window').record.get('statusEdit');
+        var statusEdit = context.view.up('window').record.get('statusEdit');
 
-        var readonlyRec = record.get('readonly');
         var grid = context.view.up('grid');
 
         //retrieve the last record of the store
-        var lastRecord = context.getStore().last()
+        var lastRecord = context.getStore().last();
 
         //Check if edit is allowed
-        if (lastRecord == record &&
-            readonlyWin == false  &&
-            readonlyRec == false) {
-            grid.getPlugin('rowedit').enable()
-        }
-        else {
-            grid.getPlugin('rowedit').disable()
+        if (lastRecord != record ||
+            statusEdit === false) {
+            grid.getPlugin('rowedit').cancelEdit();
         }
     }
 

http://lada.wald.intevation.org