comparison 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
comparison
equal deleted inserted replaced
218:1b5a0cb4fa6c 219:82f8b5638f26
48 console.log('Editing Messwert'); 48 console.log('Editing Messwert');
49 var view = Ext.widget('messwertecreate', {model: record}); 49 var view = Ext.widget('messwertecreate', {model: record});
50 console.log("Loaded Messwert with ID " + record.getId()); //outputs ID 50 console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
51 }, 51 },
52 deleteMesswert: function(button) { 52 deleteMesswert: function(button) {
53 // Get selected item in grid
54 var grid = button.up('grid'); 53 var grid = button.up('grid');
55 var selection = grid.getView().getSelectionModel().getSelection()[0]; 54 var selection = grid.getView().getSelectionModel().getSelection()[0];
56 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){ 55 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
57 if(btn === 'yes'){ 56 if(btn === 'yes'){
58 var store = grid.getStore(); 57 var store = grid.getStore();
59 store.remove(selection); 58 var deleteUrl = selection.getProxy().url + selection.getEidi();
60 store.sync(); 59 Ext.Ajax.request({
61 console.log('Deleting Kommentar'); 60 url: deleteUrl,
61 method: 'DELETE',
62 success: function(response, opts) {
63 store.reload();
64 }
65 });
66 console.log('Deleting Messwert');
62 } else { 67 } else {
63 console.log('Cancel Deleting Kommentar'); 68 console.log('Cancel Deleting Messwert');
64 } 69 }
65 }); 70 });
66 }, 71 },
67 createSuccess: function(form, record, operation) { 72 createSuccess: function(form, record, operation) {
68 // Reload store 73 // Reload store

http://lada.wald.intevation.org