Hi,
I've successfully deployed the tutorial project on my ondemand trial account and everything works fine.
Today, I tried to to extend it adding a delete button and its implementation but with no luck.
I've extended the PersonsJpaPersistenceServlet though and the deletion works fine.
I think the issue is that the server doesn't accept the DELETE http verb.
Here is the delete function in my personsdata.controller.js
delPerson : function(oTable) {
var _this = this;
var oModel = _this.getView().getModel();
var oContext = oTable.getContextByIndex(oTable.getSelectedIndex());
var id = oModel.getProperty("id", oContext);
_this.odataServiceUrl = personsListOdataServiceUrl;
jQuery.ajax({
url : _this.odataServiceUrl + "/Person?$format=json",
type : 'DELETE',
contentType : 'application/json',
data : JSON.stringify({
idToDelete : id
}),
success : function(data) {
_this.getView().getModel().refresh();
// TODO: workaround because refresh() does not rerender the
// control
oTable.unbindRows().bindRows("/Person");
// TODO: after refresh the user should receive a success message
},
error : function(jqXHR, textStatus, errorThrown) {
// TODO improve error handling
sap.ui.commons.MessageBox.alert("Failed to delete person: "
+ textStatus + "\n" + errorThrown);
}
});
Have I missed something ?
Regards.