From ace155abcb205352bb6e372aad9c21ed8bb95279 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Wed, 3 Oct 2012 15:25:53 -0400 Subject: [PATCH] Reporter: Sort contents of remote selector widgets Simple sort based on the display value. Signed-off-by: Thomas Berezansky Signed-off-by: Ben Shum --- Open-ILS/web/reports/oils_rpt_widget.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Open-ILS/web/reports/oils_rpt_widget.js b/Open-ILS/web/reports/oils_rpt_widget.js index 7e644ec7c5..28123d2c2f 100644 --- a/Open-ILS/web/reports/oils_rpt_widget.js +++ b/Open-ILS/web/reports/oils_rpt_widget.js @@ -523,6 +523,14 @@ oilsRptRemoteWidget.prototype.draw = function() { } oilsRptRemoteWidget.prototype.render = function(objs) { + var selector = this.field.selector; + objs.sort( + function(a,b){ + if (a[selector]() > b[selector]()) + return 1; + else + return -1; + }); for( var i = 0; i < objs.length; i++ ) { var obj = objs[i]; var label = obj[this.field.selector](); -- 2.11.0