diff app/controller/Messwert.js @ 219:82f8b5638f26

Fixed delete call
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 15 Jul 2013 17:10:40 +0200
parents f0c59e7ee0bc
children c32be5f97b5d
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