Sort Account-Level Course Page Terms in Descending Order

Community Champion
2 21 3,548

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) {
    var selectOptions = $('select optgroup[label="Active Terms"] option');
        return parseInt(b.value) > parseInt(a.value);
    $('select optgroup[label="Active Terms"]').html(selectOptions);

(I welcome tips for improvement, carroll-ccsd  @James ‌!)

Tags (2)