Sort Courses List On Account Details Page Script

Community Member
0 4 231

I was asked to create a script to sort courses on the Account Details page, as it can be difficult to find a course for the most current term as we don't hide previous terms from the list. It adds two sort buttons – Sort by Name (which is the default sort) and Sort by Term.


To Install:

  1. Make sure you have Tampermonkey installed in Chrome


  1. Click on the link (or copy/paste) and open in Chrome.

  1. An Install page for Tampermonkey will open, click the “Install” button.


To Use:

  1. Navigate to any User Account Details Page
    • It will work equally well on student or teacher pages.
  2. Click “Sort by Term” to sort in descending order (most recent first), click again to sort in ascending order (oldest or manually created first)


Surveyor II

I didn't even know I wanted this until I saw this post. Well done! 

I added this line to the script so the page would show the whole enrollment list without having the inner scroll bar (I hate inner scroll bars!):

//expand enrollments window
document.getElementById('courses_list').childNodes[3].childNodes[1].style.maxHeight = "";
Community Member

Wonderful! One of my colleagues asked for this and I just hadn't gotten to it yet. I'll add it! Thanks!


Matt, you may want to be careful using childNodes. Some browser include empty text nodes in childeNodes and others don't. Without checking extensively, I mostly see it's an IE issue (which I don't even pretend to support), so what you do will probably work in Firefox and Chrome, but I remember some of the stuff I was developing had issues until I switched to .children instead of .childNodes.

Since you're installing it as a user script, it probably won't matter, but someone might take this and make it available globally and I wanted to throw out a heads-up just in case it didn't work right. I always try to look for a different way, whenever possible, other than counting the number of items into something. I want to think it keeps things from breaking as quickly when/if Canvas changes something, but have no hard evidence of that.

Surveyor II

I figured this was probably super janky and overly reliant on that page structure not changing. I even have a note in my tampermonkey script for that line that says "Will probably break one day".

About the Author
I am best and happiest organizing data and ideas into information to solve complex problems. I must be creative and free to tinker and change as new processes and techniques come available.