mirror of https://github.com/apache/cloudstack.git
Sorting projects alphabetically in drop down menu
Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>
This commit is contained in:
parent
d969364daf
commit
e03a7e6fea
|
|
@ -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);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue