Help talk:Table

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Help
WikiProject icon This page is within the scope of WikiProject Help, a collaborative effort to improve the coverage of the help system on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 

Archives
Archive 1 Archive 2 Archive 3
Archive 4

Contents

[edit] Autonumbering in Tables

Howdy. Is there a way of doing autonumbering in tables? The first column in National Register of Historic Places listings in Tarrant County, Texas, for example, is manually numbered for counting purposes. We would like to keep the table format as-is, but when a new row is added, the first column has to be renumbered manually. Is there a way to set this up to autonumber? The more difficult part of this might be that the numbering column also has a template in it to shade it based on the row's classification. Any help would be appreciated! 25or6to4 (talk) 12:34, 31 August 2011 (UTC)

I don't think there is any way to do autonumbering in tables. -- John of Reading (talk) 17:19, 31 August 2011 (UTC)
it has been mentioned [the village pump] but this looks like a solution

EdwardLane (talk) 00:05, 3 September 2011 (UTC)

Hmm - maybe not quite working , it works on his page but the {{autonumbered list}} template does not quite seem to work the same outside his userspace. I've asked if he can figure out why - it's beyond me EdwardLane (talk) 03:36, 3 September 2011 (UTC)

[edit] Is there a way to display summarized wikitable statistics?

I recently created a table in List of medical schools in the Caribbean and I was wondering if there was a way to automatically display basic statistics about the table in the article. For example, "Currently there are "#" of regional schools and "#" of offshore schools," where "#" is based on the number of fields in which "offshore" and "regional" appear in the table. The number of med schools changes almost every year so it would be nice for this to be automated whenever a school is added or closed.

Can anyone tell me if this possible? Thanks! SGMD1 Talk/Contribs 21:31, 8 September 2011 (UTC)

No, I'm sorry. The table markup only arranges for the text to be displayed in rows and columns; there are none of the data-handling features that you would expect from a spreadsheet application. -- John of Reading (talk) 07:04, 9 September 2011 (UTC)


the autonumbered list 'almost functional' solution (above) uses some sort of count function to generate it's data - so it seems it might actually be 'possible' but rather tricky. EdwardLane (talk) 13:00, 9 September 2011 (UTC)

[edit] Table colors in List of Prime Ministers of Saint Kitts and Nevis

I was trying to reformat these tables to remove the red/green background colors but was having trouble. I'd like to format the tables so that the "Political Affiliation" column has two subcolumns, with the left subcolumn being small and just showing the party color, i.e. like this:

Affiliation
  Democratic Party
  Republican Party
  Independent

Thanks...any help would be appreciated! SGMD1 Talk/Contribs 05:27, 26 September 2011 (UTC)

Does this help? -- Michael Bednarek (talk) 06:29, 26 September 2011 (UTC)
Perfect! Exactly what I had in mind. It looks so much better now. Thanks!! SGMD1 Talk/Contribs 11:44, 26 September 2011 (UTC)

[edit] Controlling border colour

In one of my sandboxes I've a table which is just what I want except that the border of the cells below each subtitle is missing. I've eliminated the borders for the subtitle rows but still want them on the rows below; is there a way to do that? Thanks for any help. Mike Christie (talk - contribs - library) 22:16, 1 October 2011 (UTC)

Here's the table in question -- I'd be glad of any help with this one. The problem is the missing border line above the "Jan|Feb ..." rows. Mike Christie (talk - contribs - library) 00:29, 4 October 2011 (UTC)
Air Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Science Wonder Stories X
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Issues of Air Wonder Stories and Science Wonder Stories, with volume
and issue numbers. The editor for both magazines was David Lasser.

Why not simplify the table(s) code:

Air Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Science Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Issues of Air Wonder Stories and Science Wonder Stories, with volume
and issue numbers. The editor for both magazines was David Lasser.
Michael Bednarek (talk) 05:22, 4 October 2011 (UTC)
I put them in a single table to ensure the columns lined up, but it looks as though they are aligning anyway, so yes, that's much better. I didn't know about the subhead "|+" syntax; that's very handy. Is there a way to left align them? I tried a couple of different ways that didn't work. Mike Christie (talk - contribs - library) 12:21, 5 October 2011 (UTC)
I guess the |+ construct is hard-wired to center and can't be overridden. If you really want a table which cannot easily be made from Wikipedia syntax, you need to enter the whole thing in HTML table syntax (<table> <colgroup> <tr> <th> <td> …. In my opinion, it's almost never worth the trouble and makes the editing for fellow editors much harder. -- Michael Bednarek (talk) 12:53, 5 October 2011 (UTC)

Here's an attempt to make them float right; I'd like them one on top of the other, as happens above, and as the image they're intended to replace has it, here. Is there a way to make them do that? At the moment they float left and right. If it can't be done I can just put them on the left and flip all the subsequent images in that article so that they alternate right and left. Mike Christie (talk - contribs - library) 21:38, 6 October 2011 (UTC)

Air Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Science Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Issues of Air Wonder Stories and Science Wonder Stories, with volume
and issue numbers. The editor for both magazines was David Lasser.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

{{Clearright}} will right-align both tables:
Air Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Science Wonder Stories
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1929 1/1 1/2 1/3 1/4 1/5 1/6
1930 1/7 1/8 1/9 1/10 1/11
Issues of Air Wonder Stories and Science Wonder Stories, with volume
and issue numbers. The editor for both magazines was David Lasser.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Michael Bednarek (talk) 07:18, 10 October 2011 (UTC)

[edit] Sorting on Page Load

Is there a way to sort the table (ie. first column alphabetic then second column alphabetic) on page load? I know it's a bit complicated but for huge tables where people just keep adding info that makes sense to be alphabetized it would be fantastic.Hazmat2 (talk) 05:10, 9 October 2011 (UTC)

The new sort code is based on http://tablesorter.com/. The documentation there implies that you can set a default sort, but I don't see how to implement it. ---— Gadget850 (Ed) talk 11:29, 9 October 2011 (UTC)
Found docs at meta:Help:Sorting. I don't grasp this yet, but there is something about an "auxiliary sortable table." ---— Gadget850 (Ed) talk 12:46, 9 October 2011 (UTC)
I read Meta:Help:Sorting#Default order as clearly stating that it's not possible. -- Michael Bednarek (talk) 07:18, 10 October 2011 (UTC)

(unindent). I have had to remove numbered rank columns from tables for country data. People keep adding more nations, but have difficulty renumbering all the ranks each time a nation is added. It takes too long. So I remove the rank column, and put the nations in alphabetical order. If the country column is the first column it is easy to do with the freeware Notetab Light: Modify menu, lines, sort.

Then put back |- between each line. Do that via find-and-replace. Replace ^p with ^p|-^p

^p is a text editor code for line breaks in Notetab.
|- is the wikitext for a table row.

For an example where this was done see here: List of sovereign states by public debt. For more info see Help:Sorting and the section titled something like "initial alphabetical sort". --Timeshifter (talk) 15:05, 17 November 2011 (UTC)

[edit] Arrange table in numerical order again

I am trying to remove all the bots out of Wikipedia:List of Wikipedians by article count list so that it's fair that all the Wikipedians are mentioned in the list (we've agreed so on its talk page). However I try to remove the bots' names out of the list manually at Wikipedia:List of Wikipedians by article count/Data but when I do so the numbers are out of order. For example, Kotbot is second on the list and the next human on the list is ranked four. When I remove the bots, the numbers will all be out of order for the users on the list. Is there anyway to arrange the numbers again instead of doing it manually? (there are 3000 names on the list!). Thanks, Jaguar (talk) 22:18, 19 November 2011 (UTC)

[edit] Successive conditional table rows

Sorry, I still don't understand how to do this right, even after reading the corresponding paragraph on this page as well as several others which attempt to explain how this is done. Whatever I try, either the borders look crappy, or I get unnecessary line breaks in the last used row (if the table is not completely filled). Of course I'm using pipes, so that's not the problem. Apart from that I want to stick to a rather "clean" code without too many additional templates, if possible (I don't think that's the main problem anyway). Here is how far I could figure it out myself. I think the main issue is where to put the "if". I've put each in the previous row to make sure to not create another row in case the following content is empty. Like that, I get an additional line break for each of the following "false" rows, but that's the best solution I could figure out so far...
I would also like to see a better explanation here on the page, that's why I'm posting it here. Any suggestions and/or help would be much appreciated! --40%-Dummy (talk) 16:01, 3 December 2011 (UTC)

I still haven't managed to solve this in an elegant way, but found a way around it. Nesting the if-functions avoids the problem; however, the expansion depth limit in WikiMedia is 40 (as far as I know, no matter which MediaWiki version is used, at least all 2009-... releases). If you want to use the conditional table in a template, it is recommended to limit yourself to a nesting depth of 10 (depending on how likely it is that the template is used in combination with other parser functions). This solution is therefore not suitable for large tables. I aimed for a limit of 60 optional rows in a template, but now I question that this is a good idea anyway: The pages where the template is used are loading much more slowly with large templates. I'm not sure yet if dividing the table into 6 times 10 rows will make them load more quickly, but will find out soon. Anyway, if someone has a solution to the original problem, I'm still very interested. --40%-Dummy (talk) 18:23, 3 December 2011 (UTC)

[edit] Table Overflows Into Right Margin

In the Safari browser on an iPad in the Cladograms section a table overflows to the right edge of the right margin and pushes the right edge of the margin to the right, expanding the right margin to nearly half the page. The entire text of the article is squeezed into the left half of the page.

I see this effect in other articles, e.g., a table in the Vocabulary comparison section of the Romance Languages article, but don't know how to fix it. — Preceding unsigned comment added by 173.72.170.69 (talkcontribs) 15:50, 4 December 2011‎

[edit] Nested collapsible table table

Looks like it works!

Wiki Markup
(Nested table shown in red)

{| class="wikitable collapsible"
|-
! Header
|-
| align="center" | Content which starts visible

{| class="wikitable collapsible collapsed"

|-
! Nested Header
|-
| Nested content which starts hidden
|-
| more hidden Nested content

|}

|-
| Also visible
|}

Header
Content which starts visible
Also visible

--Iantresman (talk) 19:37, 14 December 2011 (UTC)


[edit] Sort table headers

"Do not divide a table into sections by subheaders spanning several rows. Instead, an extra column can be made showing the content of these headers on each row, in a short form."

An alternative is to make sure that the first row of the header has a single cell per column. You can then add multi-column headers on the second row, and it will still sort okay. For example:

Cluster
identifier
R. A. Dec. Constellation
Epoch J2000
Hyades 04h 26.9m +15° 52′ Taurus
Coma 12h 22.5m +25° 51′ Coma Berenices
Pleiades 03h 47.4m +24° 07′ Taurus

or even:

Cluster
identifier
Constellation
Epoch J2000
R. A. Dec.
Hyades 04h 26.9m +15° 52′ Taurus
Coma 12h 22.5m +25° 51′ Coma Berenices
Pleiades 03h 47.4m +24° 07′ Taurus

Regards, RJH (talk) 20:46, 5 January 2012 (UTC)

[edit] MediaWiki 1.19

Per the 1.19 release notes: "Style rules for wikitable are now more specific and prevent inheritance to nested tables which caused various issues."[1] ---— Gadget850 (Ed) talk 00:18, 15 January 2012 (UTC)

Thank you for the notice. This will hopefully fix the following where the nested table should not inherit the cell border property from its parent:
Screenshot of the code under MW 1.18
{| class="wikitable"
|Row 1 Col 1||
 {|
 |Nest Col1||Nest Col2
 |}
|-
|Row 2 Col 1||Row 2 Col2
|}
Row 1 Col 1
Nest Col1 Nest Col2
Row 2 Col 1 Row 2 Col2
-- Michael Bednarek (talk) 10:51, 15 January 2012 (UTC)
Then we will see what this looks like when 1.19 is implemented. Screen shot so we can compare old and new? ---— Gadget850 (Ed) talk 12:11, 15 January 2012 (UTC)
Tested under 1.19 at http://labs.wikimedia.beta.wmflabs.org/wiki/Talk:Test_cases ; seems to work properly now. -- Michael Bednarek (talk) 04:42, 16 January 2012 (UTC)

[edit] Thead, tbody and tfoot now supported?

From the article: "Thead, tbody and tfoot are supported from Mediawiki version 1.18 on." Is this true? And how do we use them? --V111P (talk) 19:54, 14 February 2012 (UTC)

[edit] Sort arrows

I apologize because this may be a stupid question. I can't seem to find the answer on the help page or the talk page archives. Why won't the sorting arrows appear at the top of the table in List of National Historic Sites of Canada in New Brunswick and related lists? Cheers, --Skeezix1000 (talk) 19:59, 3 March 2012 (UTC)

I think you've run into the bug described at Help:Sorting#Header styling, links, and markup. "Styling workaround 1" seems to work, using just background-color instead of background. -- John of Reading (talk) 22:14, 3 March 2012 (UTC)
That's it exactly. Thanks so much. --Skeezix1000 (talk) 18:18, 4 March 2012 (UTC)
Personal tools
Namespaces

Variants
Actions
Navigation
Interaction
Toolbox
Print/export