diff app/controller/grid/Probenzusatzwert.js @ 637:8acb3123b46c

Remove a new record on cancel in grids with rowediting plugin.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 17 Mar 2015 10:21:29 +0100
parents cf328526b5bb
children 5b2cbc6bc39a
line wrap: on
line diff
--- a/app/controller/grid/Probenzusatzwert.js	Mon Mar 16 17:32:15 2015 +0100
+++ b/app/controller/grid/Probenzusatzwert.js	Tue Mar 17 10:21:29 2015 +0100
@@ -12,7 +12,8 @@
     init: function() {
         this.control({
             'probenzusatzwertgrid': {
-                edit: this.gridSave
+                edit: this.gridSave,
+                canceledit: this.cancelEdit
             },
             'probenzusatzwertgrid button[action=add]': {
                 click: this.add
@@ -35,6 +36,13 @@
         });
     },
 
+    cancelEdit: function(editor, context) {
+        if (!context.record.get('id') ||
+            context.record.get('id') === '') {
+            editor.getCmp().store.remove(context.record);
+        }
+    },
+
     add: function(button) {
         var record = Ext.create('Lada.model.Zusatzwert', {
             probeId: button.up('probenzusatzwertgrid').recordId

http://lada.wald.intevation.org