Open andrewsilk opened 4 years ago
Lots of things (not everything) are possible. It's easier if the content is in the document object model (DOM) than if you have to fetch it. The name information is there, but a lot of the other information about the submission isn't. That's one of the reasons I've stayed away from the gradebook in everything I do.
The main reason I've purposefully avoided the gradebook because there is a lot going on there. It gets rerendered a lot, which means you would need to add Mutation Observers to watch for when this happens. Then you would likely have to recreate the Mutation Observers because the part you were listening to got wiped. Either that or you listen to something high up in the DOM. If I remember correctly from the last time I looked (when someone wanted to remove the curve grades assignment a few months ago). To keep things moving quickly, you may multiple layers of mutation observers. Canvas already has event listeners added to the body. You would need to make your Mutation Observer as specific as possible so that it's not slowing a lot of things down.
The gradebook is further complicated by the way it's laid out. It's not a table, so the tablesorter script I use for the roster wouldn't work. It's a simulated table using grid layout. The names and notes are in one div while the actual scores are in another. You would need to take the information from one and then apply it to the other. Definitely not as easy as table sorter.
But you're not really, I don't think anyway, wanting the functionality of table sorter where you can click at the top of any column and sort by it, you just want it to sort by first name. I don't know if that's a default or if you want to adhere to the sort by functionality and just use first name. The menu that sets the sorting is dynamically created as needed, but at least it appears a child of the body element so the Mutation Observer wouldn't have to watch the subtree.
Thankfully, sorting by first name isn't a huge deal for me because I can sort by Login ID and our login starts off with their first initial. That gets it mostly in first name order. I've also got relatively small classes (largest started at 50), so it doesn't take me long to learn their last names.
I'm trying to get the awesome functionality you created for the roster under people, but to use it in the grades tab.. Is this possible?