Stumped on complex sort

I did consider something more flexible in #12176. I have had little need for it myself, but I can easily imagine wanting it at some point. I was thinking of mine as an alternative to Shiraz tables, but would be honored, if I could get it to work, to have it folded into Shiraz.

There are three sorts of flexibility that I would love to add:

  • The ability to derive column values from one or many fields, and not just use field values directly.
  • The ability to easily create a sorter and associate it with any field. While there is something in place now in Shiraz, it only lets you associate a field name with a single sorter, across all tables in the wiki. I want configuration for the table to say that for this table use the following sorter for this specific column.
  • The ability to sort on multiple fields. Thus I want to sort on, say, political-party, ascending, then within that by score, descending; then by last-name ascending, and finally by first-name, ascending. I imagine the UI for this as simply clicking on headers, with each header cycling through none / ascending / descending states, but the other sorts that we’ve already established being used for a preliminary sort on this field. So for the choice described, we would click first-name, click last-name, click score twice (for descending) and then click political-party. This would be stored somewhere as "first-name last-name !score political-party", and the table configuration could easily default to the preferred sort-view. I made a start at doing this in JS, and just now updated it to have the three-cycle of none/ascending/descending. But the second section (filter output) would not combine well right now with the notion of fields deriving from columns.

I don’t know if I’ll ever get back to work on this, but I’m intrigued once again.