Summary: Sortable columns in simple tables
Created: 2005-03-15 13:38
From: Russ Fink
Description: Please provide an option in simple tables that enable sorting alphanumerically by column. The result would be a table with clickable headings, such that clicking on a column heading would order the table rows per the values in the selected column.
This might be represented by adding new parameters to the definition portion of a table: (a) sort=[initial_column|0] and (b) sortorder=[ascending|descending]. The semantics of "sort=x" means to do sorting, and to sort initially by column x. If x is 0, that means enable the sort header links but preserve initial as-wiki'd order. "sortorder" is optional, defaults to ascending. If "sort" is missing, give the current default table behavior, i.e, do not include sort links.
I know that PITS does this, but I don't want the entire PITS functionality, just ability to display static data in a (very large) table. I have traveled far and wide looking for this feature in various wiki's but have come up empty.
It's not at all an easy feature to implement, and there hasn't been much demand for it. I'm suspending this issue for now, but additional votes/priority can unsuspend it. --Pm
It would be a really nifty feature. Either that, or some way of making pagelists which could sort on arbitrary fields -- but I suspect that having a "table" would make it easier, since the fields to sort on would be enclosed in the data.
Being able to fill in this table with data from includes/pagelists would be even better!
Kathryn Andersen August 04, 2006, at 07:37 PM
Thirding the request... it would be a very good feature.
Feel free to make this into a cookbook. I have tested it out, and it works great. Note that I have borrowed heavily from http://www.kryogenix.org/code/browser/sorttable
HowTo make a Sortable skin:
The rest comes from Cookbook/FormattingTables and Pmwiki/Tables:
I'll try to make it more put-to-gether and post it as a skin / skin mod.
For me, the above instructions only work, if I don't copy pub/skins/pmwiki/* to pub/skins/sortable/ but edit the files inside the pmwiki skin... -- Leonard, 11.01.2008
Excellent "pre-recipe"! It works great! The sorting is a little squirrelly when dealing with upper/lower case, and numbers amidst strings, but c'est la vie. Thank you! - Wubbo, 2008-01-24
This works great for me! I'm using the triad skin, not the pmwiki (default) skin, so had to modify the pub/skins/triad/skin-triad.tmpl file instead. I downloaded the sorttable.js file to pub/skins/triad/. Thanks so much for the time and effort! -- Ly, 12.09.2008