From: Lebbeous Fogle-Weekley Date: Mon, 13 Aug 2012 15:47:48 +0000 (-0400) Subject: Fix sorting when printing from FlattenerGrid-based interfaces X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4a09e0139f4bf9f1aceb43bc94a67066d1f12147;p=evergreen%2Fpines.git Fix sorting when printing from FlattenerGrid-based interfaces This particularly affects the Simplified Hold Pull List. The printed verison of your data is supposed to reflect the same sort order that has been selected in the visual interface, and now it does. Buggy handling of the different avenues of sorting the grid (clicking column headers, using the column-picker/multicolumn-sort dialog, default sort order) had broken the flow of the data needed to build the right sort clause for some situations. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/dojo/openils/FlattenerStore.js b/Open-ILS/web/js/dojo/openils/FlattenerStore.js index 700d3f2845..6f3f989979 100644 --- a/Open-ILS/web/js/dojo/openils/FlattenerStore.js +++ b/Open-ILS/web/js/dojo/openils/FlattenerStore.js @@ -16,7 +16,8 @@ if (!dojo._hasResource["openils.FlattenerStore"]) { dojo.declare( "openils.FlattenerStore", null, { - "_last_fetch": null, /* used internally */ + "_last_fetch": null, /* timestamp. used internally */ + "_last_fetch_sort": null, /* dijit sort object. used internally */ "_flattener_url": "/opac/extras/flattener", /* Everything between here and the constructor can be specified in @@ -172,6 +173,12 @@ if (!dojo._hasResource["openils.FlattenerStore"]) { req.queryOptions = req.queryOptions || {}; req.abort = function() { console.warn("[unimplemented] abort()"); }; + /* If we were asked to fetch without any sort order specified (as + * will happen when coming from fetchToPrint(), try to use the + * last cached sort order, if any. */ + req.sort = req.sort || this._last_fetch_sort; + this._last_fetch_sort = req.sort; + if (!this.mapKey) this._get_map_key();