Forum:Sorting order in tables

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
Forums: Yew Grove > Sorting order in tables
Archive
This page or section is an archive.
Please do not edit the contents of this page.
This thread was archived on 27 March 2011 by Suppa chuppa.


I noticed that on some of the calculator tables (originally noticed on [[Calculators/Artisan Workshop]], but I've seen it on other pages) that clicking the sort arrows will sort the values lexigrapically, rather than numerically. (That is, the order is based on the first digit, rather than the total value, e.g. 1,618 - 12,018 - 192 - 26,904 - 3,001 - 830). My understanding is that there is a way to change these sorts of tables to use a numeric sort order (e.g. [1]), but I'm not one to attempt it, especially on a large scale, as seems to be called for. -- 174.31.215.221 06:59, March 12, 2011 (UTC)

Discussion

I'm sorry, but the tables are not sortable by number if there's something else (like an image) along with the number to sort. We also can't do anything like adding an invisible number before it to let it sort by that, as the numbers to be sorted keep changing along with the GE. The only way to do this is by removing the {{Coins}} template used in the tables. We could keep the colors, just not the coins image in front of it if we want to make it sort correctly.

Note to admins - Please don't close this yet. This could become a discussion to remove the {{Coins}} from all sortable tables. JOEYTJE50TALKpull my finger 12:45, March 12, 2011 (UTC)

Fixed - Using the hidden sortkey method. Leaving open in case of further discussion. Quest.png Gaz Lloyd 7:^]Events!99s 21:31, March 12, 2011 (UTC)

It seems to me that having a picture of coins in the column is not worth any amount of additional work. kitty.pngPsycho Robot talkSilver bar.png 15:58, March 14, 2011 (UTC)
I thought of something. As the tables only sort by number correctly if the only thing entered is a number, it would sort 1, 2, 10 as 1, 10, 2. We could then add 10 0's before all 1-digit numbers, 9 before 2 digit numbers etc. The code for this could then be {{Multi|0|{{#expr:11-{{#len:{{{1}}}}}}}}}{{{1}}}
Then we could place that in front of the image in the {{Coins}} template, with <span style="display:none;"></span> around it, so it sorts correctly until 9,999,999,999 (which should be enough, seeing as the highest amount of coins in RS is 2,147,483,647 Wink) and doesn't show any annoying numbers or text before the image. JOEYTJE50TALKpull my finger 17:41, March 14, 2011 (UTC)

Closed - The sorting order issue has been resolved. Suppa chuppa Talk 10:25, March 27, 2011 (UTC)