changeset 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 26863a7af202
children 5db7ab34af6d
files app/controller/Kommentare.js
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Kommentare.js	Wed May 29 15:22:38 2013 +0200
+++ b/app/controller/Kommentare.js	Wed May 29 15:27:07 2013 +0200
@@ -18,12 +18,31 @@
             'kommentarelist': {
                 // Map Doubleclick on rows of the probenlist.
                 itemdblclick: this.editKommentar
+            },
+            'kommentarelist toolbar button[action=delete]': {
+                click: this.deleteKommentar
             }
             //'probenedit button[action=save]': {
             //    click: this.updateProbe
             //}
         });
     },
+    deleteKommentar: function(button) {
+        // Get selected item in grid
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        console.log("Searching grid");
+        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
+            if(btn === 'yes'){
+                var store = grid.getStore();
+                store.remove(selection);
+                store.sync();
+                console.log('Deleting Kommentar');
+            } else {
+                console.log('Cancel Deleting Kommentar');
+            }
+        });
+    },
     editKommentar: function(grid, record) {
         console.log('Double click on ' + record.get('id'));
         // Create new window to edit the seletced record.

http://lada.wald.intevation.org