From: Lebbeous Fogle-Weekley Date: Fri, 30 Mar 2012 20:14:33 +0000 (-0400) Subject: deleting items now implemented. All four of the CRUD family are done! X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=15c8b4b3abaffdbf6e89cb00c3a2afa11834abe6;p=evergreen%2Fequinox.git deleting items now implemented. All four of the CRUD family are done! Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/web/js/dojo/openils/FlattenerStore.js b/Open-ILS/web/js/dojo/openils/FlattenerStore.js index 7c8f4ae699..e5cbdd7764 100644 --- a/Open-ILS/web/js/dojo/openils/FlattenerStore.js +++ b/Open-ILS/web/js/dojo/openils/FlattenerStore.js @@ -316,7 +316,13 @@ if (!dojo._hasResource["openils.FlattenerStore"]) { if (response.status == 402) { /* 'Payment Required' stands in for cache miss */ if (self._retried_map_key_already) { - console.error("Server won't cache flattener map?"); + var e = new FlattenerStoreError( + "Server won't cache flattener map?" + ); + if (typeof req.onError == "function") + req.onError.call(callback_scope, e); + else + throw e; } else { self._retried_map_key_already = true; delete self.mapKey; @@ -326,8 +332,6 @@ if (!dojo._hasResource["openils.FlattenerStore"]) { } }); - /* as for onError: what to do? */ - return req; }, @@ -418,7 +422,12 @@ if (!dojo._hasResource["openils.FlattenerStore"]) { * need most of the methods. */ "deleteItem": function(item) { - console.warn("[unimplemented] deleteItem() XXX TODO"); + //console.log("deleteItem()"); + + var identity = this.getIdentity(item); + delete this._current_items[identity]; /* safe even if missing */ + + this.onDelete(item); }, "setValue": function(item, attribute, value) { diff --git a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js index 647b2a8858..572e5ca784 100644 --- a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js @@ -24,8 +24,11 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { "fmClass": null, "fmIdentifier": null, "mapExtras": null, - "defaultSort": null, /* whatever the UI says /replaces/ this */ - "baseSort": null, /* whatever the UI says /follows/ this */ + "defaultSort": null, /* whatever any part of the UI says will + /replace/ this */ + "baseSort": null, /* will contains what the columnpicker + dictates, and precedes whatever the column + headers provide. */ /* These potential constructor arguments are for functionality * copied from AutoGrid */ @@ -633,6 +636,26 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { delete this.editPane; dojo.style(this.domNode, "display", "block"); this.update(); + }, + + "deleteSelected": function() { + var self = this; + + this.getSelectedItems().forEach( + function(item) { + var fmobj = new fieldmapper[self.fmClass](); + fmobj[self.fmIdentifier]( + self.store.getIdentity(item) + ); + (new openils.PermaCrud()).eliminate( + fmobj, { + "oncomplete": function() { + self.store.deleteItem(item); + } + } + ); + } + ); } } );