Skip to content

Commit

Permalink
Allow custom parameters to be passed to a DELETE service (#682)
Browse files Browse the repository at this point in the history
* Allow custom parameters to be passed to a DELETE service

* Lint fix
  • Loading branch information
geographika committed May 31, 2024
1 parent 4ce68c6 commit 04ff75b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/form/ControllerMixin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* A mixin for any edit window controller allowing for
* validation, saving, deletion, exports etc.
*
Expand Down Expand Up @@ -177,6 +177,15 @@ Ext.define('CpsiMapview.form.ControllerMixin', {
view.close();
},

/**
* Override this function to return any additional parameters to send to
* the Delete URL as a querystring
*
* @returns An object of key value pairs
*/
getDeleteParameters: function () {
return {};
},
/**
* Action for deletion
* */
Expand All @@ -189,6 +198,7 @@ Ext.define('CpsiMapview.form.ControllerMixin', {
rec.proxy.erase(Ext.create('Ext.data.operation.Destroy', {
url: rec.proxy.getUrl(),
records: [rec],
params: me.getDeleteParameters(),
callback: function (records, operation, success) {
w.unmask();
// do something whether the delete succeeded or failed
Expand Down

0 comments on commit 04ff75b

Please sign in to comment.