Repository: cloudstack Updated Branches: refs/heads/master 6766b6c6e -> 57ad60257
Sorting projects alphabetically in drop down menu Signed-off-by: Rajani Karuturi <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e03a7e6f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e03a7e6f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e03a7e6f Branch: refs/heads/master Commit: e03a7e6feaae2d024f2a53afd71e0230309b1085 Parents: d969364 Author: Daniel Vega <[email protected]> Authored: Wed Nov 5 18:30:58 2014 -0200 Committer: Rajani Karuturi <[email protected]> Committed: Thu Nov 6 10:16:15 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/e03a7e6f/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); }); },
