Page MenuHomePhabricator

Force a sortable wikitable to automatically sort by one column upon rendering
Closed, DeclinedPublic


As an editor, I would like a way to force a wikitable to sort itself by a specific column upon rendering. This is not currently possible, cf:

It is not possible to make a table appear sorted by a certain column without the user clicking on it. By default, the rows of a table always appear in the same order as in the wikitext. If you want a table to appear sorted by a certain column, you must sort the wikitext itself in that order -

Two good example use-cases:

  1. For wikitables where multiple fields change regularly/annually. These updates often necessitate resorting the wikitext itself, which can be very time-consuming (even if following the workaround described at ).
  2. For wikitables where the raw wikitext in a column is already sorted in ascending order, then a user who clicks on a heading will see no affect the first time. E.g.'Italia#By_starting_number

This feature request was recently mentioned here, but I've seen it requested many times before, e.g.

Event Timeline

Quiddity created this task.Jan 21 2016, 1:46 AM
Quiddity raised the priority of this task from to Needs Triage.
Quiddity updated the task description. (Show Details)
Quiddity added a subscriber: Quiddity.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptJan 21 2016, 1:46 AM
Krinkle closed this task as Declined.Jul 23 2016, 12:51 AM
Krinkle added a subscriber: Krinkle.

Sorting of initial render should be done server-side, not client-side.

This cannot be done in a performant way on the client and only defers the underlying problem, which is an editing or rendering problem. I suggest exploring solutions to this problem through additional features in the Parser, or via an extension, or by generating the table with a Lua module.

Either way, in a way that will output the desired HTML when the page is rendered, no matter how it is consumed or displayed. Regardless of client-side javascript (which is for interaction only).

Much thanks for the explanation, and especially for the suggested alternative solutions. :-)

Someone more technical than I am, will have to write up any further feature-requests (or code) based on those suggestions.