diff app/controller/grid/Status.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 89b337cbfb5d
children f0bc5387abcc
line wrap: on
line diff
--- a/app/controller/grid/Status.js	Mon Mar 16 17:32:15 2015 +0100
+++ b/app/controller/grid/Status.js	Tue Mar 17 10:21:29 2015 +0100
@@ -12,7 +12,8 @@
     init: function() {
         this.control({
             'statusgrid': {
-                edit: this.gridSave
+                edit: this.gridSave,
+                canceledit: this.cancelEdit
             },
             'statusgrid 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.Status', {
             messungsId: button.up('statusgrid').recordId

http://lada.wald.intevation.org