From c02ff7a618740b70ef52c55e37d177f96ef19954 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Mon, 13 Aug 2012 11:47:48 -0400 Subject: [PATCH] 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 --- Open-ILS/web/js/dojo/openils/FlattenerStore.js | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/FlattenerStore.js b/Open-ILS/web/js/dojo/openils/FlattenerStore.js index 700d3f2..6f3f989 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(); -- 1.7.2.5