# HG changeset patch # User Torsten Irländer # Date 1369834027 -7200 # Node ID 9e23eca8dfc770aa39c701aaeeb4795e47b532c0 # Parent 26863a7af20292704d2d6926aff8a682a25f1bb4 Added function to delete kommentare diff -r 26863a7af202 -r 9e23eca8dfc7 app/controller/Kommentare.js --- 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.