Mercurial > lada > lada-client
diff app/controller/grid/MKommentar.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 | b0a3580a41e9 |
children | 5b2cbc6bc39a |
line wrap: on
line diff
--- a/app/controller/grid/MKommentar.js Mon Mar 16 17:32:15 2015 +0100 +++ b/app/controller/grid/MKommentar.js Tue Mar 17 10:21:29 2015 +0100 @@ -12,7 +12,8 @@ init: function() { this.control({ 'mkommentargrid': { - edit: this.edit + edit: this.edit, + canceledit: this.cancelEdit }, 'mkommentargrid 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.MKommentar'); record.set('messungsId', button.up('mkommentargrid').recordId);