CLOUDSTACK-7849: Sorting projects alphabetically in drop down menu Signed-off-by: Rajani Karuturi <rajanikarut...@gmail.com> (cherry picked from commit e03a7e6feaae2d024f2a53afd71e0230309b1085) Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e4bf957f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e4bf957f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e4bf957f Branch: refs/heads/4.4 Commit: e4bf957f94520bb24fc8dd8af595820de08ad2e1 Parents: 2320f5e Author: Daniel Vega <daniel.sim...@corp.globo.com> Authored: Wed Nov 5 18:30:58 2014 -0200 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Thu Dec 11 20:36:17 2014 +0530 ---------------------------------------------------------------------- ui/scripts/ui-custom/projectSelect.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e4bf957f/ui/scripts/ui-custom/projectSelect.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/projectSelect.js b/ui/scripts/ui-custom/projectSelect.js index ba4c7c7..5cb4449 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 = $('<option>').val(_s(project.id)); - $option.html(_s(project.displaytext ? project.displaytext : project.name)); + $option.html(_s(project.html)); $option.appendTo($projectSelect); }); },