Help talk:Sorting

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Wikipedia Help Project (Rated NA-class, Low-importance)
WikiProject icon This page is within the scope of the Wikipedia Help Project, a collaborative effort to improve Wikipedia's help documentation for readers and contributors. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. To browse help related resources see the Help Menu or Help Directory. Or ask for help on your talk page and a volunteer will visit you there.
 NA  This page does not require a rating on the project's quality scale.
 Low  This page has been rated as Low-importance on the project's importance scale.
 

Update on wikitable caused several problems in sortable tables.[edit]

The new display of sortable buttons in column headers of a sortable table caused several good-looking tables to be ruined. Things noticed:

  • Table headers having a separate row for sorting now have their main headers also have these buttons. In addition to looking redundant, these main header buttons also take up the space that was intended to be used by the other columns.

(see its effects on table examples in: Help:Sorting#In a narrow space: sorting buttons in a separate row)

  • Nested tables (that are unsortable) also have these sorting buttons at their headers when they are nested inside a sortable table.
  • Even table 'footers' have these up-down sorting buttons.

It appears the solution I know of is at the moment is to painstakingly add class="unsortable" to all headers (and footers) so that these sorting buttons disappear. Is there a better/easier solution than this? Sanglahi86 (talk) 18:28, 5 February 2016 (UTC)

Looks like a bug that needs to be reported to Phabricator. I don't have time now. I don't know when I will get time. --Timeshifter (talk) 01:33, 8 February 2016 (UTC)

Splitting a long sortable table to display as two side-by-side sections[edit]

I am looking to make a sortable table which has a lot of rows (over 200) and instead of having it display as one long table, is there any method to have it display as two side-by-side "columns" on the page (similar to using {{colbegin}} to split lists into multiple columns) but still have it be a single sortable table? – Lestatdelc (talk) 04:48, 17 February 2016 (UTC)

{{div col}} with {{div col end}} works perfectly like in this table. — Sanglahi86 (talk) 22:00, 3 December 2016 (UTC)

Sort ascending/descending is backwards[edit]

Ascending sort means that the values get bigger as you go down, descending sort means the values get smaller as you go down. Currently this is reversed.[1]. — Preceding unsigned comment added by 143.48.49.193 (talkcontribs) 11:32, 4 March 2016‎

You link to Sorting#Sorting information or data. I think you are referring to the tooltip on the sort button? If so, I see that the tooltip label changes depending on whether clicking it will sort the column in ascending order or descending order. So if the column is currently in ascending order, then the tooltip says "Sort descending". --Timeshifter (talk) 19:04, 4 March 2016 (UTC)
@Timeshifter and 143.48.49.193: It wasn't just there. I just corrected Help:Sorting on Wikimedia, referring the edit summary to this that I wrote on the Talk page[2]:


Order in the court!
Please note the definitions of ascending and descending order:
  • The order in how information is sorted or arranged, ascending order is always arranged from lowest to highest. For example, "1, 2, 3, 4, 5" and "a, b, c, d, e, f" are both arranged in ascending order.
  • The order in how information is sorted or arranged, descending order is arranged from highest to lowest. For example, "5, 4, 3, 2, 1" and "e, d, c, b, a" are both arranged in a descending order.
I would not have thought it necessary to explain this here, but see this diff.


--Thnidu (talk) 01:14, 4 September 2016 (UTC)


References

Handing refs on dates?[edit]

In List of Alpha Kappa Psi chapters there are a few dates that have references, so the entries in the table are like

January 5, 1900

January 6, 1900<ref>blah-blah</ref>

January 8, 1900

Any suggestions on how to handle this? Naraht (talk) 18:37, 5 July 2016‎ (UTC)

try {{dts}}. Frietjes (talk) 13:12, 3 August 2016 (UTC)
Just on the ones with refs, or do all need to be changed?Naraht (talk) 14:42, 3 August 2016 (UTC)
Naraht, if you use {{dts}} you will probably need to change them all. if you just want to modify the rows with refs, you can try the method described in specifying a sort key for a cell. unfortunately, that does require specifying the date twice. another method would be to put the reference in its own column, but that splits the ref from the information being referenced. you could try Forcing a column to have a particular data type, but that really only works in limited situations. Frietjes (talk) 18:13, 3 August 2016 (UTC)

Existing large tables[edit]

Many existing tables use sort keys. For example, the table in List of circulating currencies § List of circulating currencies by state or territory uses 309 of them (cat | grep -ci "Sort\|+"). Help:Sorting admonishes us that for four types of sorting modification, "This methodology is deprecated, in favor of using" data-sort-value, data-sort-type="text", or both.

data-sort-value and data-sort-type are pretty long to type. How about equivalent abbreviations, like dst and dsv? And 309 is a lot of changes to make in just this table; any suggestions for automating, like a bot?

Please {{Ping}} me to discuss. --Thnidu (talk) 02:14, 4 September 2016 (UTC)

Initial Sorting - How is it done?[edit]

There is instructions telling you that you have to sort the table before you save the page to get the default sort order you want, but nowhere does it tell how I do this. There is no "sort arrows" in the gui when you create the table. So do I need to manually move rows up and down one by one till I get it correct? Even if I only want it to be sorted by the first column? — Preceding unsigned comment added by 84.55.110.220 (talk) 12:34, 18 January 2017 (UTC)

That phrasing in the help page is a bit misleading; "you must sort the wikitext itself in that order" means you have to create the wikitext in the required order. Sometimes an external text editor might be helpful, but there is no standard tool in the Wikipedia editing window. -- Michael Bednarek (talk) 13:06, 18 January 2017 (UTC)
I clarified the info in that section: Help:Sorting#Initial sort order of rows. It links to more info in another section here. I clarified that section too concerning faster methods to initially sort a table. --Timeshifter (talk) 19:57, 18 January 2017 (UTC)