Mercurial > lada > lada-client
comparison app/controller/grid/Messwert.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 | f2742f9b5a64 |
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 'messwertgrid': { | 14 'messwertgrid': { |
15 edit: this.gridSave | 15 edit: this.gridSave, |
16 canceledit: this.cancelEdit | |
16 }, | 17 }, |
17 'messwertgrid button[action=add]': { | 18 'messwertgrid button[action=add]': { |
18 click: this.add | 19 click: this.add |
19 }, | 20 }, |
20 'messwertgrid button[action=delete]': { | 21 'messwertgrid 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.Messwert', { | 47 var record = Ext.create('Lada.model.Messwert', { |
40 messungsId: button.up('messwertgrid').recordId | 48 messungsId: button.up('messwertgrid').recordId |