Jump to content

Help talk:Table

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Note: You can also ask questions here: Help desk. Teahouse. Village pump (technical).

Scope=row in bottom row in long tables?

[edit]

A year ago I started a discussion on whether scope=row should be used for the bottom row or use |-style="background-color:#EAECF0; font-weight:bold; text-align:center" to get the same result. In the meantime, a scrolling table template was created: {{sticky table start}}, which makes the col headers sticky and solves the need for a scoped bottom row as a copy of the top row...on smaller screens, for the most part, and on mobile but NOT for wider screens. In my case (table 1 and table 2), the col headers are not sticky when scrolling vertically, which would then need a copy of the top row in the bottom.

Which leads me to this question: do I/should I use scope=row or only visually mimic bolded/gray color appearance that scope produces using the above wiki markup in the aforementioned tables or leave them as is? Qwerty284651 (talk) 21:52, 13 August 2024 (UTC)[reply]

Your table 1 and table 2 examples are identical. --Redrose64 🌹 (talk) 06:47, 14 August 2024 (UTC)[reply]
Fixed 2nd table to link to the doubles page. Qwerty284651 (talk) 08:50, 14 August 2024 (UTC)[reply]
Something is flaky with that table. The sticky top header row comes and goes as I move my mouse or scroll. I would remove all the unnecessary stuff, one-by-one, to see what is causing it:
Remove style="height:3em" from the header row. This may be causing the problem because sticky templates are tuned to the headers.
Remove {{big}} from header text.
Remove style="font-size:95%"
Remove class=nowrap
Some of the above 4 may be the problem. Some may work together to cause the problem. The top 3 are totally unnecessary. Nowrap is useful for keeping the lines from wrapping. But that means people will be scrolling horizontally more.
Scope=col and scope=row are probably not part of this problem, at least not by themselves. They are unnecessary, though, for simple tables. As this table is.
--Timeshifter (talk) 08:21, 14 August 2024 (UTC)[reply]
I usually scope in all table headers regardless of the table's complexity to be on the safe side with accessibility-compliance. I am still wrapping my head around when to use scope and when not. Help:Table#Scope is provided in an example of a simple table, so I assume it should be used everywhere.
The above 4 markups are just cosmetics. Will eliminate them 1 at a time in my sandbox. Qwerty284651 (talk) 08:59, 14 August 2024 (UTC)[reply]
Removing scope="row" would cause accessibility issues. In tables, generally speaking, header cells are implicitly column scope unless the scope= attribute is provided. For a header cell at the top of a column of data cells, you can use an explicit scope="col" but don't need to. For header cells at the left of a row of data cells, such as the years in the Table 1 example, scope="row". --Redrose64 🌹 (talk) 18:49, 14 August 2024 (UTC)[reply]

Scope=row is not needed for simple tables. See:

Help:Table#Scope is a generalization, because going into the specifics baffles many new table editors. And because it is based on a very old MOS guideline written in the days of yore before the many improvements of screen readers. Experienced table editors read the actual WCAG, etc. guidelines, and see that on simple tables it serves no purpose. But I don't want to argue about it. Read the links for yourself and decide. It certainly doesn't hurt anything to add more rather than less scopes. --Timeshifter (talk) 21:08, 14 August 2024 (UTC)[reply]

Interesting. Qwerty284651 (talk) 14:12, 15 August 2024 (UTC)[reply]

Bug report: caption prevents sorting

[edit]

Adding a caption to a sortable table prevents sorting. sticky-table-head is not the cause. Qwerty284651 (talk) 22:31, 21 August 2024 (UTC)[reply]

It also undoes any row-/colspan in mobile which is bizarre. Removing headerSortUp and sticky-table-unsticky didn't solve the problem. Qwerty284651 (talk) 22:41, 21 August 2024 (UTC)[reply]
@Qwerty284651: From the looks of it, you replaced
|-

with

|+Per player

instead of

|+Per player
|-
Jroberson108 (talk) 22:51, 21 August 2024 (UTC)[reply]
Meant to add caption before the first row thusly. Qwerty284651 (talk) 23:59, 21 August 2024 (UTC)[reply]

Rowspan/Background interaction

[edit]

How do you stop rowspans and background colours interacting?

i.e.

Normally this would happen:

   
 

How do I make the table so row two's colour is all across row two but I still have a cell that spans from row one into row two while keeping the colour of row one? Mn1548 (talk) 15:13, 4 September 2024 (UTC)[reply]

@Mn1548: You can't. It's how table cells have always (i.e. since HTML 3.2 way back in 1997) worked. --Redrose64 🌹 (talk) 21:54, 4 September 2024 (UTC)[reply]
OK, thanks Mn1548 (talk) 21:56, 4 September 2024 (UTC)[reply]

Search table help pages

[edit]

I am trying to add the following search form to Template:Table help. But I need to prefill the search with this:

<inputbox>
id = style-searchbox
type=fulltext
width=20
break=no
namespaces=Help** 
searchbuttonlabel = Search table help pages
</inputbox>

How do I do that? --Timeshifter (talk) 00:54, 6 September 2024 (UTC)[reply]

Well, you don't, as such. You need to provide the search parameters in a supported way. There's a lot there, but taking them one by one...
offset=0
That's the default, you don't need to specify that
limit=50
Is it really necessary to pre-decide on a limit value? That's probably also the default, anyway.
ns12=1
You have the namespaces param already
search=intitle%3Atable
That's searchfilter=intitle:table, to an <inputbox>...</inputbox>. However, the docs seem to imply that it only works with type=search, not type=fulltext, so you may have to switch types.
advancedSearch-current={%22fields%22:{%22intitle%22:%22table%22}}
I don't think you can set up an advanced search with the <inputbox>...</inputbox>, but those params look redundant with the searchfilter args so hopefully it'll work without them.
So looks like it should be just,
<inputbox>
id=style-searchbox
width=20
break=no
type=search
searchbuttonlabel=Search table help pages
searchfilter=intitle:table
namespaces=Help** 
</inputbox>
Though I also wonder if prefix=Help: might work better than the namespaces= parameter? FeRDNYC (talk) 05:16, 6 September 2024 (UTC)[reply]
Testing with Special:ExpandTemplates shows that searchfilter= does actually work with type=fulltext, so you're good there. FeRDNYC (talk) 05:22, 6 September 2024 (UTC)[reply]
Ohhhh! Now I see what namespaces= is about.
The ** suffix doesn't really do anything unless you have at least two namespaces specified. Then, it shows checkboxes directly in the form, and ** decides which one(s) is/are pre-checked. So, for example, if I add ,Wikipedia to the definition above...
But if you're just specifying a single namespace, you don't need the ** following it. FeRDNYC (talk) 05:28, 6 September 2024 (UTC)[reply]

Thanks!

<inputbox>
id=style-searchbox
width=20
break=no
type=fulltext
searchbuttonlabel=Search table help pages
searchfilter=intitle:table
namespaces=Help
</inputbox>

It may need to wrap if necessary in portrait view in mobile view. Though I notice that the search form shrinks as needed, as I narrow my browser window. So maybe it does not need to wrap. Will look at it in mobile phone.

And is it possible to get it to open the results in a new tab? I have the gadget preference enabled for "Open search results in a new tab or window when holding down the Ctrl key".

But it does not seem to be working for this. (Oops. The problem is with Firefox. Other browsers work).

I went ahead and added it to the template so I can see how it looks in my mobile phone:

--Timeshifter (talk) 17:44, 6 September 2024 (UTC)[reply]

Currently there isn't a way to open the results in a new tab, that request is tracked as T253940. FeRDNYC (talk) 17:56, 6 September 2024 (UTC)[reply]
Thanks for the info and link. --Timeshifter (talk) 18:02, 6 September 2024 (UTC)[reply]

I shortened it to "Search all" in order to get it to fit in portrait view in my cell phone. --Timeshifter (talk) 18:25, 6 September 2024 (UTC)[reply]

The search form has since been discussed and edited further. See:
Wikipedia:Village pump (technical)/Archive 216#How to block part of page from Wikipedia search engine
--Timeshifter (talk) 10:33, 7 November 2024 (UTC)[reply]

Wikitable is broken on Wikipedia mobile app

[edit]

Why below table is totally broken on Wikipedia mobile app? (iPhone 11, iOS 18.1)

Issues-

  • table content is not visible in any of the cells, though headers are showns.
  • table is shown white, though app mode is dark.

Currency composition of foreign exchange reserves (COFER) (billion US$)
Foreign currencies' reserves
United StatesUSD European UnionEUR JapanJPY United KingdomGBP CanadaCAD ChinaRMB AustraliaAUD SwitzerlandCHF Other
currencies
Unallocated
reserves
Total
Time period
2019 Q1 6,727.09 2,208.79 584.63 495.70 208.64 212.26 181.95 15.27 263.50 712.93 11,610.77
Q2 6,752.28 2,264.88 611.87 497.41 209.85 212.80 186.71 15.53 270.56 715.88 11,737.76
Q3 6,728.85 2,212.74 612.75 492.22 205.44 213.83 182.48 16.20 262.92 729.40 11,656.82
Q4 6,674.83 2,279.30 631.00 511.51 206.71 215.81 187.18 17.36 281.50 749.55 11,824.74
2020 Q1 6,794.91 2,197.30 624.97 486.08 195.13 221.48 170.16 16.05 255.53 770.32 11,731.94
Q2 6,902.01 2,272.44 643.70 504.36 215.47 233.68 190.34 17.22 278.67 754.11 12,011.98
Q3 6,927.16 2,359.61 668.19 523.64 231.10 247.44 199.51 19.30 283.16 787.44 12,246.56
Q4 6,990.97 2,526.41 715.35 561.39 246.57 271.60 216.87 20.74 314.63 841.14 12,705.67
2021 Q1 6,971.79 2,404.80 686.30 554.28 250.01 293.32 214.89 19.44 335.82 851.50 12,582.14
Q2 7,070.33 2,458.88 672.20 560.90 270.01 314.81 218.44 23.13 357.57 865.83 12,812.12
Q3 7,087.77 2,462.44 681.42 561.66 264.29 320.15 214.26 23.77 354.77 860.67 12,831.20
Q4 7,087.14 2,486.88 671.77 576.22 286.93 336.10 218.02 24.51 362.96 886.73 12,937.27
2022 Q1 6,868.97 2,328.35 626.44 569.45 286.02 330.03 221.91 29.48 387.80 858.65 12,507.09
Q2 6,645.02 2,187.63 572.65 538.73 275.75 308.22 209.14 27.63 358.62 858.26 11,981.65
Q3 6,426.89 2,086.40 560.11 489.95 260.92 281.12 204.78 24.78 358.59 841.74 11,535.29
Q4 6,460.21 2,252.06 608.17 543.11 262.62 287.81 217.08 25.31 383.64 877.79 11,917.81
2023 Q1 6,630.89 2,186.33 610.39 605.02 270.60 287.12 221.62 28.26 389.07 877.53 12,029.03
Q2 6,641.89 2,207.25 597.15 533.64 278.51 272.99 219.70 21.26 403.72 887.06 12,055.26
Q3 6,497.94 2,150.47 598.73 530.36 274.36 260.12 222.35 20.30 426.63 920.27 11,901.53
Q4 6,687.11 2,287.57 652.90 553.91 295.25 261.73 241.78 26.38 442.77 883.06 12,332.46
2024 Q1 6,774.82 2,253.79 654.52 562.48 295.64 247.10 248.42 21.93 439.56 885.35 12,383.61
Q2 6,675.82 2,265.29 641.07 565.92 306.85 245.17 256.45 22.43 486.89 881.90 12,347.42
Q3
Q4

WikiAlliance09 (talk) 10:36, 4 November 2024 (UTC)[reply]

@WikiAlliance09: I think you should move this over to Template talk:Sticky header. --Timeshifter (talk) 10:29, 7 November 2024 (UTC)[reply]
thanks... done... please close this topic.... WikiAlliance09 (talk) 14:26, 7 November 2024 (UTC)[reply]
@WikiAlliance09 and Timeshifter: Not sure why it was suggested to move this to Template:Sticky header, which that template isn't used and has no relevance. In regard to the problem, I see the table data on my Android phone's Chrome browser. Maybe you can give more details on how to reproduce the problem? Jroberson108 (talk) 18:11, 7 November 2024 (UTC)[reply]
already mentioned that issue is on iPhones with iOS 18. WikiAlliance09 (talk) 06:01, 8 November 2024 (UTC)[reply]
Dark mode doesn't show the content because the colors are too similar due to setting background: none; on the table. Jroberson108 (talk) 18:19, 7 November 2024 (UTC)[reply]
I requested the move because I am seeing a sticky header. I don't know why, but I figured someone at Template talk:Sticky header would. And that WikiAlliance09 might want to use the standard sticky header templates. --Timeshifter (talk) 21:07, 7 November 2024 (UTC) Oops. I had the sticky gadget turned on.[reply]
Aren't text colours and background colours two different things? WikiAlliance09 (talk) 11:07, 8 November 2024 (UTC)[reply]
@WikiAlliance09: They are, but background color is behind the text color, so colors can't be too similar so it's readable. Header cells have a background-color set from the "wikitable" class, but not the data cells. Jroberson108 (talk) 17:35, 8 November 2024 (UTC)[reply]
Also, making tables taller is usually preferred over wider due to width constraints on the desktop version (visible on wider tables). The "Time period" row header cell could be moved up above the year and quarter headers and fill that blank space as a column header. After the move, the extra background and border styles can be removed. Jroberson108 (talk) 17:45, 8 November 2024 (UTC)[reply]

2-Cells in one row in one column

[edit]

Hi I would like to know how to have 2 column cells put under one column. I've been looking through this article but I just can't figure out how.

Example table
Col 1 Col 2 Col 3
Row 1 Text here Split this into one column | and another column
Row 2 Other text But this is still one column
Row 3 Some more text This one too

If you notice in Col 3, Row 1; I would like to split that column for that specific row by that vertical line, but I'm unsure how.
If anyone has a solution, please show me the wikitext and what it produces
Thanks, Closercamera901 (talk) 00:39, 16 November 2024 (UTC)[reply]

@Closercamera901: You need to add colspan="2" to all third column cells including the header cell except for row one's cell, then add a fourth cell to row one. This makes the table have four columns. See Help:Table#Colspan and rowspan. Jroberson108 (talk) 02:08, 16 November 2024 (UTC)[reply]
Thank You Very Much - Closercamera901 (talk) 17:16, 16 November 2024 (UTC)[reply]