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