From e03a7e6feaae2d024f2a53afd71e0230309b1085 Mon Sep 17 00:00:00 2001 From: Daniel Vega Date: Wed, 5 Nov 2014 18:30:58 -0200 Subject: [PATCH] Sorting projects alphabetically in drop down menu Signed-off-by: Rajani Karuturi --- ui/scripts/ui-custom/projectSelect.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/scripts/ui-custom/projectSelect.js b/ui/scripts/ui-custom/projectSelect.js index ba4c7c73d23..5cb444978aa 100644 --- a/ui/scripts/ui-custom/projectSelect.js +++ b/ui/scripts/ui-custom/projectSelect.js @@ -30,11 +30,21 @@ response: { success: function(args) { var projects = args.data; + var arrayOfProjs = []; $(projects).map(function(index, project) { + var proj = {id: _s(project.id), html: _s(project.displaytext ? project.displaytext : project.name)}; + arrayOfProjs.push(proj); + }); + + arrayOfProjs.sort(function(a,b) { + return a.html.localeCompare(b.html); + }); + + $(arrayOfProjs).map(function(index, project) { var $option = $('