changeset 217:4db982514a5f

Fixed issue21
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 15 Jul 2013 16:30:52 +0200
parents 6aedf2026fb4
children 1b5a0cb4fa6c
files app/controller/Orte.js app/model/Ort.js
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Orte.js	Mon Jul 15 15:30:52 2013 +0200
+++ b/app/controller/Orte.js	Mon Jul 15 16:30:52 2013 +0200
@@ -102,11 +102,17 @@
         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 Ort');
             } else {
-                console.log('Cancel Deleting Kommentar');
+                console.log('Cancel Deleting Ort');
             }
         });
     },
--- a/app/model/Ort.js	Mon Jul 15 15:30:52 2013 +0200
+++ b/app/model/Ort.js	Mon Jul 15 16:30:52 2013 +0200
@@ -20,6 +20,11 @@
             type: 'json',
             root: 'data'
         }
+    },
+    getEidi: function() {
+        var ortId = this.get('portId');
+        var probeId = this.get('probeId');
+        return "/" + ortId + "/" + probeId;
     }
 });
 

http://lada.wald.intevation.org