comparison app/controller/grid/PKommentar.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 f0bc5387abcc
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 'pkommentargrid': { 14 'pkommentargrid': {
15 edit: this.edit 15 edit: this.edit,
16 canceledit: this.cancelEdit
16 }, 17 },
17 'pkommentargrid button[action=add]': { 18 'pkommentargrid button[action=add]': {
18 click: this.add 19 click: this.add
19 }, 20 },
20 'pkommentargrid button[action=delete]': { 21 'pkommentargrid 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.PKommentar'); 47 var record = Ext.create('Lada.model.PKommentar');
40 record.set('probeId', button.up('pkommentargrid').recordId); 48 record.set('probeId', button.up('pkommentargrid').recordId);

http://lada.wald.intevation.org