commit 309df7cf979e693810bdd10831d7f557c583125f
parent 09eb8bdf76e98522324657f95700a0ce9760c3f7
Author: Felicitus <felicitus@felicitus.org>
Date: Wed, 23 Sep 2015 16:46:51 +0200
Added parameter to ignore IDs when updating
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraProxy.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraProxy.js
@@ -24,6 +24,11 @@ Ext.define("PartKeepr.data.HydraProxy", {
*/
ignoreLoadId: null,
+ /**
+ * If true, ignores IDs when updating/deletes entries
+ */
+ ignoreIds: false,
+
constructor: function (config)
{
config.url = PartKeepr.getBasePath() + config.url;
@@ -59,14 +64,20 @@ Ext.define("PartKeepr.data.HydraProxy", {
if (request.getRecords().length != 1) {
throw "The amount of records updating must be exactly one";
}
- this.api.update = request.getRecords()[0].getId();
+
+ if (!this.ignoreIds) {
+ this.api.update = request.getRecords()[0].getId();
+ }
}
if (request.getAction() == "destroy") {
if (request.getRecords().length != 1) {
throw "The amount of records updating must be exactly one";
}
- this.api.destroy = request.getRecords()[0].getId();
+
+ if (!this.ignoreIds) {
+ this.api.destroy = request.getRecords()[0].getId();
+ }
}
return this.callParent([request]);