Sortable Wiki Tables

Today I was reading an old comment from someone who had tried to update the CPF wiki with a table of flashlights and what kinds of batteries they use. To me this is something of fairly limited value because there are hundreds, if not thousands, of flashlights. And keeping a list up-to-date would be a lot of work. Plus I think most doing research on lights will know what their options are.

But the table this guy was trying to put in (he was stopped by the moderator for some reason) was pretty interesting. It lets you click on the headings of the table to sort by that column. I didn’t realize such a thing existed, but it is pretty neat. Anyway, the guy had posted a few rows of the code he had written, so I made a new entry here to see how it works. It puts a funky symbol in the heading that looks kind of like an elevator Door Close button (><). Then you click to sort by that column, which then toggles for ascending and descending. Pretty neat. And while there are all kinds of things that Wikipedia can do through add-on templates, the sortable table is built-in to the default installation of MediaWiki.

I added in a row of my own, but it's kind of a pain writing Wiki tables (though easier than in HTML). If I ever really develop this page, I think I would make an Excel spreadsheet and then export from Excel to Wiki using this online tool.

One thought on “Sortable Wiki Tables

  1. I took a table of flashlight output measurements that were in a spreadsheet and turned them into a sortable table. This way you can look up a light by name with the first column alphabetically, or the battery type by sorting on that. You can do a secondary field sort by sorting the secondary field first and then the primary.

    Flashlight Output Table

Leave a Reply

Your email address will not be published. Required fields are marked *