From 7db767154831465e14f9c42f0f6f062df05db654 Mon Sep 17 00:00:00 2001 From: senator Date: Thu, 7 Oct 2010 17:18:58 +0000 Subject: [PATCH] Add some reasonable default sorting to this expired holds list git-svn-id: svn://svn.open-ils.org/ILS/trunk@18222 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/extras/circ/alt_holds_print.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/opac/extras/circ/alt_holds_print.html b/Open-ILS/web/opac/extras/circ/alt_holds_print.html index 370aa98ee0..30fdd65da8 100644 --- a/Open-ILS/web/opac/extras/circ/alt_holds_print.html +++ b/Open-ILS/web/opac/extras/circ/alt_holds_print.html @@ -111,10 +111,25 @@ ); } + function place_by_sortkey(node, container) { + /*Don't use a forEach() or anything like that here. too slow.*/ + var sortkey = dojo.attr(node, "sortkey"); + for (var i = 0; i < container.childNodes.length; i++) { + var rover = container.childNodes[i]; + if (rover.nodeType != 1) continue; + if (dojo.attr(rover, "sortkey") > sortkey) { + dojo.place(node, rover, "before"); + return; + } + } + dojo.place(node, container, "last"); + } + function do_shelf_expired_holds(user, cgi) { progress_dialog.show(true); var any = false; + var target = dojo.byId("target"); fieldmapper.standardRequest( ["open-ils.circ", "open-ils.circ.captured_holds.expired.print.stream"], { @@ -174,7 +189,10 @@ "delay": false }); - dojo.place(tr, "target"); + dojo.attr( + tr, "sortkey", hold.usr.display_name + ); + place_by_sortkey(tr, target); } ); }, -- 2.11.0