Sort Account-Level Course Page Terms in Descending Order
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
The terms list on the account-level course page is sorted in ascending order. When I filter terms, I almost always want the current term or a recent term. Having to scroll to the bottom of our long list of terms is annoying, so I wrote some JavaScript (with the help of Stack Overflow) to sort the list by term ID in descending order. In case anyone else might find this useful, here it is:
if (window.location.pathname.indexOf('accounts') > -1) {
// https://stackoverflow.com/questions/20693593
var selectOptions = $('select optgroup[label="Active Terms"] option');
selectOptions.sort(function(a,b){
return parseInt(b.value) > parseInt(a.value);
});
$('select optgroup[label="Active Terms"]').html(selectOptions);
}
(I welcome tips for improvement, carroll-ccsd @James !)
Labels
21 Comments
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.