comparison app/controller/Kommentare.js @ 59:9e23eca8dfc7

Added function to delete kommentare
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 29 May 2013 15:27:07 +0200
parents 4fa3fba50f79
children 5db7ab34af6d
comparison
equal deleted inserted replaced
58:26863a7af202 59:9e23eca8dfc7
16 // CSS like selector to select element in the viewport. See 16 // CSS like selector to select element in the viewport. See
17 // ComponentQuery documentation for more details. 17 // ComponentQuery documentation for more details.
18 'kommentarelist': { 18 'kommentarelist': {
19 // Map Doubleclick on rows of the probenlist. 19 // Map Doubleclick on rows of the probenlist.
20 itemdblclick: this.editKommentar 20 itemdblclick: this.editKommentar
21 },
22 'kommentarelist toolbar button[action=delete]': {
23 click: this.deleteKommentar
21 } 24 }
22 //'probenedit button[action=save]': { 25 //'probenedit button[action=save]': {
23 // click: this.updateProbe 26 // click: this.updateProbe
24 //} 27 //}
28 });
29 },
30 deleteKommentar: function(button) {
31 // Get selected item in grid
32 var grid = button.up('grid');
33 var selection = grid.getView().getSelectionModel().getSelection()[0];
34 console.log("Searching grid");
35 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
36 if(btn === 'yes'){
37 var store = grid.getStore();
38 store.remove(selection);
39 store.sync();
40 console.log('Deleting Kommentar');
41 } else {
42 console.log('Cancel Deleting Kommentar');
43 }
25 }); 44 });
26 }, 45 },
27 editKommentar: function(grid, record) { 46 editKommentar: function(grid, record) {
28 console.log('Double click on ' + record.get('id')); 47 console.log('Double click on ' + record.get('id'));
29 // Create new window to edit the seletced record. 48 // Create new window to edit the seletced record.

http://lada.wald.intevation.org