From: Lebbeous Fogle-Weekley Date: Fri, 9 Mar 2012 17:54:37 +0000 (-0500) Subject: Followup fix to teaching AutoGrid to reload_opac() X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bcdbd3ab560658c8f83f9de624c3a39b1dcc2e2b;p=contrib%2FConifer.git Followup fix to teaching AutoGrid to reload_opac() For deleting a list of selected items, only reload_opac() once at the end, not once for each item deleted. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 69df9a7494..947d56c844 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -343,15 +343,23 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { dojo.forEach(items, function(item) { var fmObject = new fieldmapper[self.fmClass]().fromStoreItem(item); - new openils.PermaCrud()['eliminate'](fmObject, {oncomplete : function(r) { self.store.deleteItem(item) }}); + new openils.PermaCrud()['eliminate']( + fmObject, { + oncomplete : function(r) { + self.store.deleteItem(item); + if (--total < 1) { + try { + xulG.reload_opac(); + } catch (E) { + (dump ? dump : console.log)(E); + } + } + } + } + ); } ); - try { - xulG.reload_opac(); - } catch (E) { - (dump ? dump : console.log)(E); - } }, _formatRowSelectInput : function(rowIdx) {