From 5ebaf746568c4d51863b73533fb4c3af530d27de Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Mon, 1 Oct 2012 16:46:56 -0400 Subject: [PATCH] LP#1010027: more internal options for xul lists specifically, give fm_columns a sort_headers flag for alphabetizing the columns returned by label; and delete_me flag for omitting a column definition entirely Not all xul lists are using fm_columns yet Signed-off-by: Jason Etheridge Signed-off-by: Jennifer Pringle Signed-off-by: Ben Shum --- .../staff_client/chrome/content/util/list.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index 0eba98bdec..f9a962fac3 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -2059,6 +2059,7 @@ util.list.prototype = { var obj = this; var columns = []; if (!prefix) { prefix = ''; } + var sort_headers = false; try { // requires the dojo library fieldmapper.autoIDL if (typeof fieldmapper == 'undefined') { throw 'fieldmapper undefined'; } @@ -2164,6 +2165,9 @@ util.list.prototype = { def.remove_me = true; } } + if (column_extras['*']['sort_headers']) { + sort_headers = true; + } } if (column_extras[col_id]) { for (var attr in column_extras[col_id]) { @@ -2172,6 +2176,9 @@ util.list.prototype = { if (column_extras[col_id]['keep_me']) { def.remove_me = false; } + if (column_extras[col_id]['remove_me']) { + def.remove_me = true; + } if (column_extras[col_id]['label_prefix']) { def.label = column_extras[col_id]['label_prefix'] + def.label; } @@ -2194,6 +2201,16 @@ util.list.prototype = { } } + if (sort_headers) { + columns.sort( + function(a,b) { + if (a.label > b.label) { return 1; } + if (a.label < b.label) { return -1; } + return 0; + } + ); + } + } catch(E) { obj.error.standard_unexpected_error_alert('fm_columns()',E); } -- 2.43.2