Wiki - Table column sorting
- Suggestion / Request:
- It would be great to have some table column sorting features on redmine Wiki.
- Here is a script that does the job:
Thanks to Brian McAllister
- At a glance…
- Multiple columns can be sorted at once by pressing Shift while selecting the columns using either the keyboard or mouse;
- The new script sorts (on average – based on my very non-scientific calculations), 5 times faster than its predecessor;
- The plug-in architecture makes writing custom sort functions a breeze;
- The script can highlight both alternate rows and full columns on a table by table basis;
- Like its predecessor, the script is fully keyboard accessible;
- The script can correctly determine a columns datatype should a datatype not be explicitly defined (datatypes determined are limited to numbers, text, currency values and dates);
- The script is smart enough not to sort columns containing identical data
- Tables can be automatically sorted on a column (or columns) of your choice, even in reverse order;
- Before-sort and after-sort callback functions (or Object.methods) can be defined for individual tables.
- Row and column highlighting:
- The script enables both row and column highlighting.
- Zebra striping the table rows:
- Should the table be given the class rowstyle-something, each alternate table row is given the class something after the table has been sorted i.e giving the table a class of rowstyle-alternate will tell the script to give each alternate row the class alternate.
- Highlighting the currently sorted column:
- Should the table be given the class of colstyle-something, each TD node within the sorted column is given the class something after the table has been sorted i.e giving the table the class colstyle-alternate will tell the script to give each TD node within the sorted column the class alternate.
- Making any column sortable:
- To make any table column sortable, just give the associated table header (TH) tag the class sortable, the script will automatically determine the column datatype, make the entire table header clickable (and not just the text contained within) and create the appropriate up/down arrow within the header when clicked (using the ↑ & ↓ characters).
- Forcing a columns sort algorithm:
- Should a column contain a mix of datatypes (or should you know the column datatype), it is advised that you explicitly set the sort algorithm by adding one of the following classNames to the associated table header (TH) tag: sortable-numeric, sortable-currency, sortable-text , sortable-date, sortable-date-dmy or sortable-keep (which keeps the row in it’s original order).
- Sorting multiple columns:
- The script can now sort multiple columns. Just hold down the Shift key while selecting the columns to sort (either with the keyboard or with the mouse).
#4 Updated by Alexander Golovko almost 3 years ago
Not very cool, but usable:
#5 Updated by Hrobky Hrobky over 1 year ago
It was not working on my
2.1.4.stable.10880. Maybe the plugin is missing some installation script or there is a change in plugin structure since 2.x.
ln -s ../../plugins/redmine_sortable_table-master/assets/ sortable_table
Operator '%' seems to be overridden to do HTML escaping, so do the concatenation in other flavor: