comparison 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
comparison
equal deleted inserted replaced
636:f4f76fc04e28 637:8acb3123b46c
10 extend: 'Ext.app.Controller', 10 extend: 'Ext.app.Controller',
11 11
12 init: function() { 12 init: function() {
13 this.control({ 13 this.control({
14 'mkommentargrid': { 14 'mkommentargrid': {
15 edit: this.edit 15 edit: this.edit,
16 canceledit: this.cancelEdit
16 }, 17 },
17 'mkommentargrid button[action=add]': { 18 'mkommentargrid button[action=add]': {
18 click: this.add 19 click: this.add
19 }, 20 },
20 'mkommentargrid button[action=delete]': { 21 'mkommentargrid button[action=delete]': {
31 }, 32 },
32 failure: function() { 33 failure: function() {
33 // TODO 34 // TODO
34 } 35 }
35 }); 36 });
37 },
38
39 cancelEdit: function(editor, context) {
40 if (!context.record.get('id') ||
41 context.record.get('id') === '') {
42 editor.getCmp().store.remove(context.record);
43 }
36 }, 44 },
37 45
38 add: function(button) { 46 add: function(button) {
39 var record = Ext.create('Lada.model.MKommentar'); 47 var record = Ext.create('Lada.model.MKommentar');
40 record.set('messungsId', button.up('mkommentargrid').recordId); 48 record.set('messungsId', button.up('mkommentargrid').recordId);

http://lada.wald.intevation.org