changeset 219:82f8b5638f26

Fixed delete call
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 15 Jul 2013 17:10:40 +0200
parents 1b5a0cb4fa6c
children 8e41a5a6cb7f
files app/controller/Messwert.js
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Messwert.js	Mon Jul 15 17:10:31 2013 +0200
+++ b/app/controller/Messwert.js	Mon Jul 15 17:10:40 2013 +0200
@@ -50,17 +50,22 @@
         console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
     },
     deleteMesswert: function(button) {
-        // Get selected item in grid
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
         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');
+                var deleteUrl = selection.getProxy().url + selection.getEidi();
+                Ext.Ajax.request({
+                    url: deleteUrl,
+                    method: 'DELETE',
+                    success: function(response, opts) {
+                        store.reload();
+                    }
+                });
+                console.log('Deleting Messwert');
             } else {
-                console.log('Cancel Deleting Kommentar');
+                console.log('Cancel Deleting Messwert');
             }
         });
     },

http://lada.wald.intevation.org