added confirmation dialog before delete

This commit is contained in:
Sebastian Sdorra
2010-09-05 19:26:33 +02:00
parent a6cdf204d5
commit 2de1949167

View File

@@ -186,21 +186,30 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
console.debug( 'remove item ' + id );
}
// TODO show confirmation dialog
var store = this.store;
var url = String.format( this.restRemoveUrlPattern, id );
Ext.Ajax.request({
url: url,
method: 'DELETE',
success: function(){
store.reload();
},
failure: function(){
alert( 'failure' );
Ext.MessageBox.show({
title: 'Remove Item',
msg: 'Remove Item "' + id + '"?',
buttons: Ext.MessageBox.OKCANCEL,
icon: Ext.MessageBox.QUESTION,
fn: function(result){
if ( result == 'ok' ){
Ext.Ajax.request({
url: url,
method: 'DELETE',
success: function(){
store.reload();
},
failure: function(){
alert( 'failure' );
}
});
}
}
});
}
},