Help talk:Table/Archive 4

Latest comment: 12 years ago by Michael Bednarek in topic MediaWiki 1.19
Archive 1 Archive 2 Archive 3 Archive 4 Archive 5 Archive 6 Archive 9

Text to be centered only in certain cell

Title Year Author and Notes
First text Second text Third text
First text Second text Third text

I want automatically the "year" cell to be centered, how can I do that? Except manually adding style="text-align: center;" to each separating sign ("|-"). Userpd (talk) 21:08, 9 July 2010 (UTC)

As far as I know, that's the only way it can be done:
Title Year Author and Notes
r1 c1 text r1 c2 text r1 c3 text
r2 c1 text r2 c2 text r2 c3 text
We'd all like column styles to be applied from the first row automatically, but there's some limitation which prevents that from working. I think I read about it in bugzilla several years ago. —EncMstr (talk) 22:17, 9 July 2010 (UTC)
«but there's some limitation which prevents that from working.» And I was wondering why can't I apply vertical align for the first row automatically. Also, why don't you use valign=top instead of style="vertical-align:top;"? Userpd (talk) 18:01, 10 July 2010 (UTC)

Display the value from one infobox in another one within the same article

{{A infobox
|par1 =
|par2 =
}}

{{B infobox
|par1 =
}}

I have two infoboxes in one article. I would like the value of the parameter "par1" from A infobox display as the parameter "par1" in B infobox. If the "par2" in A infobox is not empty, change the background color of B infobox. Is it possible to do it? --WlaKom (talk) 21:30, 10 July 2010 (UTC)

I don't think you can do that, unless you created a special template for it (which I don't think is a good idea), like {{A infobox|par1={{something}}}} {{B infobox|par1={{something}}}}. What exactly are you trying to do? Also, what does this have to do with tables? This is probably not the best page to discuss this issue. Svick (talk) 22:06, 10 July 2010 (UTC)

Footnotes

I need to insert footnotes into a table. Could anyone add a section in the text describing process. Or at least write me so I can do it.RonRodex (talk) 17:35, 25 July 2010 (UTC)

Footnotes would be added like any other text. See WP:FOOTNOTES for an overview of the process. ---— Gadget850 (Ed) talk 20:53, 25 July 2010 (UTC)

Problems with display

  Resolved

I wasn't sure where to ask for help, so came here. I have a problem with the display of a centered table. There are two problems which may or may not be related. Also, I use old browsers, so others may not be seeing what I see; if not please tell me. The two problems are both displayed in the article 42 (number), in the table with the caption "In other languages".

  1. The first problem is that the table is centered, but the table caption is sort of half centered. The caption text is placed to the left of where it should be. I also see this problem in this article at Help:Table#Centering tables.
  2. The second problem is that the table insists on displaying at the end of the article, just before the Categories. This is despite the fact that the table markup is higher up than that. No matter where the markup is placed in the article, the table always displays at the end (which is not where I want it to be).

Thanks for any help you can give. (Please respond here.) HairyWombat 01:46, 7 August 2010 (UTC)

I saw that table apprearing at the bottom of the page too. And it's really weird. I don't have a clue how I fixed it, because at my first edit it went back to normal and I couldn't reproduce the bug.
The table is well centered. If your are using old browsers because your boss told you to, please slap him gently for me. If it's your own decision... well... just do something about it. ;-) Cheers, Dodoïste (talk) 08:33, 7 August 2010 (UTC)

Great, many thanks. I use the most recent browsers that my operating system can support. Upgrading to more recent browsers would require a whole new computer. HairyWombat 14:01, 7 August 2010 (UTC)

Oh, interesting case. I did not know that Firefox doesn't work with old operating systems. In this case, you can use Ubuntu (operating system). Ubuntu is free and works just fine with old computers. You'll be able to have the latest version of Ubuntu for free, and install the latest browsers. You may even find an install-party near your place and have someone do the job for you! :p Dodoïste (talk) 23:50, 7 August 2010 (UTC)

Centering a column

Is there an easier way to center all of the entries for an entire column, rather than putting align=center or {{center|text}} for every entry? Cmcnicoll (talk) 23:08, 30 April 2010 (UTC)

This is my PRECISE question. Can someone please answer? Smashman2004 (talkcontribsemail) 09:18, 12 May 2010 (UTC)
No, there is no other way. If you have a complex table, you can edit it in Excel or OpenOffice Calc and convert it to wikimarkup and retain the formatting. http://excel2wiki.net/wikipedia.php ---— Gadget850 (Ed) talk 13:14, 12 May 2010 (UTC)
Is there a way of using a template or wikitable class to make whole columns right aligned (or centred)? This is for simple tables, just with some columns left aligned and some right aligned. It is very cumbersome to have to put align=right in every cell. --Pakaraki (talk) 20:36, 17 September 2010 (UTC)

Needs update

Hi. This help page should be updated according to Wikipedia:Manual of Style (accessibility)#Data tables. Tables headers should be made using "! scope="col" |" and "! scope="row" |", instead of only "!". The scope attribute tells the browser and screen reader that everything under the column is related to the header at the top, and everything to the right of the row header is related to that header. It's a straightforward concept. Yours, Dodoïste (talk) 11:17, 28 July 2010 (UTC)

I've done part of it, but this page is long, I need help! ;-) Dodoïste (talk) 03:51, 29 July 2010 (UTC)
Why don't we add this to the wikitable class instead of updating a gazillion tables? ---— Gadget850 (Ed) talk 15:38, 2 August 2010 (UTC)
Because it's impossible. The scope attribute of the <tr> tag can contain 4 values: row, col, rowgroup and colgroup. Those are used to determine what kind of header "<tr>" is. With CSS we can only add one attribute to all headers. With CSS we could decide that "headers are all column headers" for example. But that would be wrong in at least half of the cases, and completely useless. And this attributes can't be added by a bot as well, because it can't be automated.
Providing information about the headers is important for accessibility, and for reuse of the data as well. See Creating Accessible Tables, 2) Data Tables, WebAIM techniques.
Most important parts of this help page are updated now. A few things could be improved here and there, but the priorities are done. Yours, Dodoïste (talk) 00:26, 3 August 2010 (UTC)
See MediaWiki_talk:Common.css#some wikitable ideas. ---— Gadget850 (Ed) talk 12:23, 16 August 2010 (UTC)

Repeating Headers, possible?

Would there be a way to have the header of the table appear automatically every X (lets say 20 in this case) entries? It can't be done manually with a sorted table without having the headers sorted with the rest of the entries can it? This is needed as in a table with many columns the viewer may lose track of which column is which if the headers don't show up every X amount of entries.

Lets say header every 5 entries for this table, is there any way to make it so the headers stay in place and are not sorted (or a way to automate this)?

Header 1 Header 2 Header 3
1 a a
2 b b
3 c c
4 d d
5 d d
Header 1 Header 2 Header 3
6 e e
7 e e
8 f f
9 g g
10 h h

Repeating headers in the middle of the table causes accessibility issues. See Data tables tutorial#Avoiding column headers in the middle of the table. You'd better split the tables in several smaller tables. Dodoïste (talk) 01:53, 26 September 2010 (UTC)

Sorting tables with NA values (On VPT)

Please take a look at this VPT discussion regarding tables and NA values. Thanks. Protonk (talk) 20:28, 23 September 2010 (UTC)

Thoughts

 
 

The edit interface shown in the screenshot is for the Monobook skin only, since not all users use the Monobook skin shouldn't other screenshots be added? Regards, —Ғяіᴆaз'§ĐøøмChampagne?9:37pm 11:37, 25 September 2010 (UTC)

You're right. Here is a screenshot found on commons. I believe this page is not the only one concerned. Could you add this screenshot to the related pages? Thanks. :-) Dodoïste (talk) 16:01, 25 September 2010 (UTC)
  Done Dodoïste (talk) 20:34, 25 September 2010 (UTC)
Sorry I couldn't do it, I was asleep at the time. Thanks for putting it up Dodo :) Regards, —Ғяіᴆaз'§ĐøøмChampagne?11:27am 01:27, 26 September 2010 (UTC)

Outsize screen percentages no longer work?

I've been wondering about this for a while. It used to be that when using percentages for the widths of columns, you could set the total width of the table to be wider than the screen display, ie the screen display width could be, say, 120% of the visible width. Now when I try to do this however, the table just won't display beyond the visible width. Has the code been altered so this feature no longer works? Gatoclass (talk) 11:25, 3 November 2010 (UTC)

It sounds like you have been using a browser bug. I bet it wasn't supposed to be stable and future-proof anyway. Did you update your browser? Can you provide a link to your examples, so I can test and provide a more useful answer? Dodoïste (talk) 13:16, 3 November 2010 (UTC)
Well I can't give you a working example, because the feature doesn't seem to work anymore! But if, for example, you go to the Allaire Iron Works page, and look at the table at the bottom, if you fiddle with the values in that, you will probably find that you can't make the table expand beyond the visible width no matter what you do. Gatoclass (talk) 06:34, 4 November 2010 (UTC)

Unusual sorting

Hi. The table in this question is undergoing constant change, but my question can be demonstrated by this version of the page. Click once on the sort button in the "Change in rank" column and then scroll down to look at the two "0" entries. It's not that important, but I'm curious to discover why the two "0"s aren't together? Aside from that question: I didn't add any sorting code to the entries in the column, so was quite impressed to see the negative entries sort correctly in relation to the positive entries. Cheers.  HWV258.  07:22, 4 November 2010 (UTC)

Alternating row colors?

Is it possible to have a sortable wikitable like the following, but with alternating row colors that "stay put" when a different sort order is chosen, rather than following the data associated with that row? 28bytes (talk) 05:36, 24 September 2010 (UTC)

Song Performer Peak Date Peak
"Rapper's Delight" Sugarhill Gang January 12, 1980 36
"Savannah Nights" Tom Johnston January 12, 1980 34
"Romeo's Tune" Steve Forbert February 23, 1980 11
"Yes I'm Ready" Teri DeSario March 1, 1980 2
"With You I'm Born Again" Syreeta April 19, 1980 4
"Set Me Free" Utopia April 19, 1980 27
"Only a Lonely Heart Sees" Felix Cavaliere April 19, 1980 36
"Pilot of the Airwaves" Charlie Dore May 3, 1980 13
"The Seduction" James Last Band May 24, 1980 28
"Funkytown" Lipps Inc. May 31, 1980 1
"Gee Whiz" Bernadette Peters May 31, 1980 31
"Should've Never Let You Go" Dara Sedaka May 31, 1980 19
"Cars" Gary Numan June 7, 1980 9
Yes, it is feasible - and much needed. But in order to archive that we must ask an admin to add a CSS class to MediaWiki:Common.css. Afterward, simply adding « class="alternategrey" » at the top of the table would do the trick.
We won't be adding a CSS class for every colors possible though, so I recommend you use standard grayscale instead of brown.
It uses a CSS 3 property. With Vector, it works in every browser, because JQuery also support this CSS property.
With monobook however, it works in every major browser (Firefox, Safari, Chrome, Opera and the soon-to-be-released IE9) - but not IE8. When JQuery will be implemented in every skin (which is planned), this property will work whatever the browser you use. Since this is only a layout detail, I believe it's fine to use it now anyway.
The code to add in MediaWiki:Common.css is:
table.alternategrey tr:nth-child(even) {background: #E0E0E0;}
Yours, Dodoïste (talk) 15:36, 24 September 2010 (UTC)
Thanks very much for that info. The specific change I was hoping to make was to have different background colors for each of the three large tables in List of Atari 2600 games, patterned after the differently colored tables in List of 1980s one-hit wonders in the United States.
Looking at MediaWiki:Common.css, I see ".navbox-even" and ".navbox-odd" entries, which I deduce make the navboxes display the alternate colors. Since different navboxes use differently colored striped backgrounds, I wonder if that's implemented in template code someplace, or in a different .css file? 28bytes (talk) 15:52, 24 September 2010 (UTC)
Well, if the community agree we can add a CSS class for a set of colors (I'd say about 3 to 6 colors). But we need to gather consensus on that beforehand.
Speaking of it, I don't know how it works here so I don't know how to make it happen. Should we fill a RFC or something? How will we convince an admin to make this edit?
In the Navbox case, it's in the template code. And it doesn't use the technique I suggest, it uses the same inline style as you do in your example table above. I haven't seen a live exemple of this function though, so I can't provide more details about it. Dodoïste (talk) 16:22, 24 September 2010 (UTC)
See MediaWiki talk:Common.css/Archive 12#CSS striped for .wikitable. ---— Gadget850 (Ed) talk 16:50, 24 September 2010 (UTC)


(edit conflict) See the prior proposal at
The colours would be fixed; just what colours would work best with the default header-cell colour is an open question. Jack Merridew 16:54, 24 September 2010 (UTC)
Thanks everyone. Since that discussion was archived (and presumbly not implemented?), what would be the proper venue to bring it up again? It would be great to have a (small) palette to choose from, (something like the following) to help pages with multiple tables be easier to follow. 28bytes (talk) 17:23, 24 September 2010 (UTC)
table.alternategrey   tr:nth-child(even) {background: #E9E9E9;}
table.alternategreen  tr:nth-child(even) {background: #D0F0C0;}
table.alternateblue   tr:nth-child(even) {background: #D5EDFF;}
table.alternatepink   tr:nth-child(even) {background: #FDE2EB;}
table.alternateyellow tr:nth-child(even) {background: #FFFFAA;}
I just changed slightly the proposed colors, to provide enough contrast between the background color and the light blue of external links. This way, we ensure that the vast majority of tables using this class will have enough contrast whatever their content, thus being accessible and conformed to WP:ACCESS.
Add those styles to your vector.css, and have a look at the tables at User:Dodoïste/Sandbox. How do you like it? Dodoïste (talk) 18:36, 24 September 2010 (UTC)
Hmm, I must be missing a step, I'm not seeing any colors. 28bytes (talk) 18:50, 24 September 2010 (UTC)
Would help if I switched my prefs to Vector, wouldn't it? :) I can see the colors now, they look great. 28bytes (talk) 18:55, 24 September 2010 (UTC)

I'll support a grayscale form of this proposal along the lines of the zebra-striping using some wikitable-compatible grey for the off-rows. Offering-up a set of à la carte colour-picks is inappropriate, however. Colours should have semantic meaning, which means selecting them by some means other than by colour-name. Jack Merridew 04:22, 25 September 2010 (UTC)

I agree. I just don't see the need for colors. Among other issues, they will not print well on monochrome printers. ---— Gadget850 (Ed) talk 04:40, 25 September 2010 (UTC)
I also agree. If we don't want Wikipedia to look like a Christmas tree with colors everywhere, we'd better keep the grayscale. However, if it was only me I would have kept the blue stripping too, because I love it and I believe it goes well with the Vector theme.
Also, naming this CSS class "zebra" instead of "alternategrey" will make it really easier to remember and to use.
Note this is also an accessibility improvement. Users with dyslexia will find large tables much easier to use when row colors are alternated.
So, taking into account the comments, here is the CSS class we should add:
table.zebra   tr:nth-child(odd) {background: #E9E9E9;}
Kind regards, Dodoïste (talk) 05:40, 25 September 2010 (UTC)
We already have colors. The point of my request was to fix the way the sorting works on the tables that have them. 28bytes (talk) 12:28, 25 September 2010 (UTC)
Don't worry, those can be fixed; they're all MOS vios per WP:Deviations; the colours are mere gratuitous ornamentation. Jack Merridew 05:05, 26 September 2010 (UTC)
Even if a small palette is rejected, could we at least have two? A regular (grey) and an alternate (blue) would make it much easier for readers to differentiate two adjacent tables. 28bytes (talk) 12:54, 25 September 2010 (UTC)
No; be happy if you get gray. Even then, there's the view that none of this is actually helpful:
Jack Merridew 05:05, 26 September 2010 (UTC)
Interesting study. I will say I agree with the subjects who found the striping more aesthetically pleasing. Regardless, I will indeed be happy if some form of striping is available for sortable tables, and I will be grateful for any help making that a reality. 28bytes (talk) 06:20, 26 September 2010 (UTC)

This is up for discussion at MediaWiki talk:Common.css/Archive 13#Zebra striping, again. Cheers, Jack Merridew 23:14, 9 November 2010 (UTC)

Thanks for posting the link, I'd been wondering about that. 28bytes (talk) 23:23, 9 November 2010 (UTC)

couldn't find help for this

Please show me how to fix this. Thanks, Espoo (talk) 19:37, 23 November 2010 (UTC)

I don't see any problem with removing the blank lines. It makes the text wrap beside the table. Is that a problem? —EncMstr (talk) 21:02, 23 November 2010 (UTC)
I assume the OP uses a narrow browser window. Since the content to the right is relatively wide, I think it would be nice if the main content had a minimum width in this case. I went looking for a template that does this, but came up empty. Try adding something like this instead of the blank lines:
<div style="margin-bottom:-18pt">{{pad|200px}}</div>
It's a massive hack, that would need to be improved before use, but I hope you can see the effect I'm after. Try resizing the browser window to see the effect. --Mepolypse (talk) 21:45, 23 November 2010 (UTC)
Very strange. When i opened the version prior to my edit just now, "Several similar" was all alone at the left of the Venn diagram, and the text below the tables started incomprehensible with "linguistic concepts are related to homonymy". But now i cannot reproduce the problem even with the old versions after i pressed Ctrl+0 in Firefox, no matter what text size i use. --Espoo (talk) 09:21, 25 November 2010 (UTC)

Interactive tables

I think one of the next thing mediawiki software needs to implement is to upgrade tables to be more interactive. When I say that I am thinking about the ability to show/hide some rows and columns, defined in some kind of profile. Take for example this list: List of countries by population. For example an interactive table would be capable to show the countries of a single continent, and hide those from other continents, when the user needs that. Also would help the user see the first 5 countries from each continent for example. When you have a conversation with someone, you might want to show just some of the data in the table, therefore you would like to be able to hide the columns 4,5 and 6, because they are not relevant in your discussion. Profiling tables would mean adding some filters (simple or sophisticated), or simply to manually define each profile. However implemented in the software, I don't think it would ask for extensive work from the programmers, also it won't load the browser with too much JavaScript, but it would be for sure a MASSIVE improvement for the way data can be presented and make use of. Thanks. —  Ark25  (talk) 01:00, 11 December 2010 (UTC)

Thanks for your thoughtful suggestion. The best places to suggest this are Village Pump Proposals area, and possibly as a feature suggestion for the developers at WP:BUG. —EncMstr (talk) 01:23, 11 December 2010 (UTC)

spacing and padding definition

It would be useful for the article to precisely define the terms cellspacing and cellpadding and clarify the difference between them. I've tried them both, but I can't figure out what the difference is, although they clearly don't do the same thing. —MiguelMunoz (talk) 22:32, 19 December 2010 (UTC)

Cell spacing is the space between adjacent cells; cell padding is extra space inside a cell. See this and click on the corresponding terms for a graphical explanation. —EncMstr (talk) 22:43, 19 December 2010 (UTC)

UGLY

This page has become unnavigable and ugly. Is there a way we could streamline this, adopt some common styles and images to use as a base, and, oh, I don't know, generally clean it up. I tried finding something for a friend and just kept getting lost in this mess over and over. Sven Manguard Wha? 04:18, 5 January 2011 (UTC)

100% agree. Tables are hard enough as it is. An overhaul is needed keeping beginners in mind. Anna Frodesiak (talk) 04:35, 5 January 2011 (UTC)
Maybe organize it as if it were for "shoppers". Show the product with the "how-to" and "what-made-it-look-that-way" underneath. Anna Frodesiak (talk) 04:37, 5 January 2011 (UTC)
Or maybe organize it by code, showing the effect, isolated from other code, so users can see exactly what each bit of code produces.
At the moment, what I find frustrating, is that the code that is responsible for an appearance is not shown. I see a bunch of code and a result. I have no idea what results in what, so I have to use trial and error to figureit out. Anna Frodesiak (talk) 04:41, 5 January 2011 (UTC)
I use tables quite a lot and have become pretty frustrated with this help page as well. I usually resort to looking at numerous articles to find an existing table that kind of looks like what I want; then I copy it to my sandbox and by trial and error methods tweek it to get the result I want - or as close as I can get it. In addition to establishing a better direct relationship with the code and the result it generates, there is a need to show how multiple codes interact with each other to give a new result. Whatever, changes are made to the page, there should be a library of examples given (I mean dozens) to pick from. While I dislike too much control, it is also necessary to have the table format policies or preferences of the Wiki world reflected in and restated with each example. Some tables in some articles so complex that editors with the potential to contribute a lot of quality content are disuaded from participating because they are overwhelmed by the complex codes - not good. Middle ground is required.Newwhist (talk) 12:31, 5 January 2011 (UTC)
Hooray for vindication. Now does anyone know an expert in Wikitables that could do the changes? Sven Manguard Wha? 19:09, 5 January 2011 (UTC)
I am. I intend to work on it in a sandbox—perhaps User:EncMstr/Help Table. Due to real life challenges, I won't be able to start for a few days, but then it should go rapidly. —EncMstr (talk) 20:45, 5 January 2011 (UTC)
If there's any way I can help, please just ask. Anna Frodesiak (talk) 23:34, 5 January 2011 (UTC)

Centering a Table

Currently, this page dictates (under Mélange) that the appropriate way to center a table is by using:

{| align="center"
|+ '''An example table'''
|- ...
! 

This, however, does not work in firefox, only in internet exploder. If you look at the wiki behind the example after the markup, it is, in fact, using margin:auto - so the markup syntax above the example is essentially lying.

Note that the other section that shows centering tables (Help:Table#Centering_tables) dictates that style="margin: 1em auto 1em auto;" should be used. The first section should definitely be corrected, and then some consistency is needed. --Alainbryden (talk) 14:56, 17 January 2011 (UTC)

Image as header: accessibility problem?

Does the use of images for headers (per Help:Table#Vertically oriented column headers create accessibility problems? For example, seems like screen-readers would not be able to recognize or interpret the "text". Should there always also be an WP:ALT for each image with the plain text contents (alt=Date/Page, and alt=VG:Project (link to Wikipedia:WikiProject Video games) or alt=Wikipedia:WikiProject Video games, for the first two columns in the sample)? DMacks (talk) 16:38, 21 January 2011 (UTC)

Switching columns

What's the easiest way to switch columns around in a table? I was wondering if there was a way to do it using Excel because I'm working on a table for a list article within my user pages and I'd like to switch a couple of columns. There already about 50 or so rows in the table and I'd like to save time and frustration from doing it manually if I could. –Dream out loud (talk) 09:16, 1 February 2011 (UTC)

You are on the right track. Highlight and copy the wiki table, then paste it into Excel. Make your changes, copy the cells and paste into http://excel2wiki.net/. Copy and paste the results. ---— Gadget850 (Ed) talk 17:36, 1 February 2011 (UTC)

Splitting a table

Is there a way I can make a table split automatically - a sort of Template:Div col for tables? Thanks. Roscelese (talkcontribs) 01:43, 28 February 2011 (UTC)

tooltip in header row

I have seen a table in an article that has abbreviations in its header row ("ABC") that were marked somehow (maybe underlined with a dotted line) and when you hover your mouse cursor over the abbreviation a tooltip appeared with the full text ("Advanced Beta Collision"). This is very handy instrument - because sometimes you want to present a short yes/no (or small number) in the column, but the name of the column is long and if you have multiple such long-named-columns the table becomes too wide. Using such tooltips solves the problem.

Does anyone know where I can find (again, because I don't remember where I saw it) such article or how to do such tooltips? Alinor (talk) 06:16, 27 March 2011 (UTC)

Found Template:Abbr. Alinor (talk) 07:24, 27 March 2011 (UTC)
Before you use {{Abbr}}, you should consider Template:H:title ({{H:title|Advanced Beta Collision|ABC}} gives ABC. Apparently, this has some advantages for vision-impaired users who use screen readers; see Talk:Spiccato#Abbr element in sound file description. Maybe you could ask User:Graham87 to review your edit. -- Michael Bednarek (talk) 11:14, 27 March 2011 (UTC)
Marking abbreviations with {{Abbr}} is a good thing indeed, and it is accessible to blind users (and others) like User:Graham87. However, Template:H:title uses incorrect tricks to produce the same appearance, and thus is not accessible to blind users such as Graham87. Since H:title is used for just about anything, and not only abbreviations, this issue is difficult to fix. Cheers, Dodoïste (talk) 13:54, 27 March 2011 (UTC)

Sort by name in table

Hello! I just created a List of members of the 15th Landtag of Baden-Württemberg, but can't find a practical way to sort them by surname. De.wikipedia has a similar list, and they use {{sortkey}} in their syntax, which unfortunately does not seem to work in en.wikipedia. Could somebody tell me how to do it or point me in the right direction, please? --Charlotte N. Burg (talk) 14:29, 29 March 2011 (UTC)

Have a look at {{Sort}} or {{Sortname}}. -- John of Reading (talk) 14:53, 29 March 2011 (UTC)
The name of the German template is de:Vorlage:SortKey (note the capital "K"); that template has an interwiki link to {{Sort}} where the section "See also" lists i.a. {{Sortname}} – voilà. -- Michael Bednarek (talk) 05:54, 30 March 2011 (UTC)

Thank you very much, that should help me figuring out how to do it. --Charlotte N. Burg (talk) 11:10, 30 March 2011 (UTC)

Default sort for sortable table

How do I set the default sort order for a sortable table? I haven't been able to find the answer in the various help pages. Of course I know that it can be done manually by entering the data in the desired default order, but I'm not clever enough to work out how to pre-sort a long list of mixed wikilinked and unlinked names. Justlettersandnumbers (talk) 12:54, 8 April 2011 (UTC)

I think you answered your question; a table will first appear as coded. If you want a table to reappear in that order after having sorted it, reload it. -- Michael Bednarek (talk) 15:54, 8 April 2011 (UTC)
I found the answer in the end, here. The suggested workaround doesn't work with mixed wikilinked and unlinked text entries either, nor can I see how reloading would do so. Anyway, it's done, insert [[ before all entries, search-and-replace [[[[ back to [[, remove [[ manually from unlinked text. Thanks for answering. Justlettersandnumbers (talk) 16:18, 8 April 2011 (UTC)

Reproducing the contents of a given tables cell (and of a given article), in some other article

How does one reproduce the contents of a given tables cell and given article in a different article?130.56.80.185 (talk) 20:04, 1 May 2011 (UTC)

Copy it or use a template. ---— Gadget850 (Ed) talk 20:23, 1 May 2011 (UTC)

Help needed on Commons

It may not be the right place to ask for help but I have a problem with tables on Commons. I tries to create. I tried to create a somewhat intricate translation template that seems to work but that breaks tables. Does anyone know any possible reason for that ? --Superzoulou (talk) 10:36, 20 May 2011 (UTC)

Executive summary: over at commons:Template:Technique/testcases there is a table where each row looks like | xx || some nowiki'd text || {{template1}} || {{template2}}. The pipes between the two template calls are not functioning as table delimiters but are instead appearing in the rendered page. I'll think about this over lunch (UK time...) -- John of Reading (talk) 11:51, 20 May 2011 (UTC)

s

Seems to be fixed with this edit and this edit. -- John of Reading (talk) 12:33, 20 May 2011 (UTC)
Ok thanks, it works now. I don't understand why it causes that but I suppose it means this kind of template is somewhat britlle ?--Superzoulou (talk) 13:41, 20 May 2011 (UTC)
Actually I had not noticed my excess curly brackets so I hope this is good enough for use, especially with your fixes--Superzoulou (talk) 13:55, 20 May 2011 (UTC)
The problem was that two of the sub-templates were putting out extra newlines. I don't know why that broke the table, though. -- John of Reading (talk) 16:35, 20 May 2011 (UTC)

No way to add cells?

I guess these tables are just a "format", really, and nothing too intricate or interconnected beyond that. But just in case, I'm curious, is there a way to have a Total: at a "sortbottom" lowest row that automatically updates for numbers generated in the rest of the table? Or do totals have to be updated manually? I figured the multiplication table example on this page would have these "auto" results, as well as the Help:Sorting page, which has a lot of examples with "totals", if it were possible, so maybe it's not. Thanks! – Kerαunoςcopiagalaxies 03:31, 22 June 2011 (UTC)

No, you'll have to calculate the totals yourself. Welcome to the 1980s! -- John of Reading (talk) 09:55, 22 June 2011 (UTC)
That's what I figured. At least these neon legwarmers won't go to waste. – Kerαunoςcopiagalaxies 10:37, 22 June 2011 (UTC)

Table floating a distance from the left

I'm drafting an article on a poem in a dialect of English. The actual poem will be a column down the left. Readers not acquainted with the dialect will need a glossary, which I would like to: be vertically on the same level as the text and about 10em to the right of the text, not right-aligned; formatted as a table, so that each entry is a row and there is a title "Glossary" at the top of the table. Can any one help me? --Philcha (talk) 19:40, 2 August 2011 (UTC)

A table with two columns should do:

Ha! Whare ye gaun, ye crowlin ferlie?
Your impudence protects you sairly,
I canna say but ye strunt rarely
Owre gauze and lace;
Though faith, I fear ye dine but sparely
On sic a place.

ferlie=

strunt=strut

second stanza
goes here
and on
and 4
and 5
and 6

glossary

on=continues

Michael Bednarek (talk) 06:50, 3 August 2011 (UTC)

Table Flipping

I'm sure someone has figured out how to do this easily but I'm stumped. Take an article like Italian_Open_(tennis) and the mens singles table. It starts in the year 2011 but at wiki tennis project we want it to start in 1930. If we don't want it sortable but we want it reversed what's the easiest way to do it? If I make the table sortable and then click on year to reverse the order, that's the way I want it to look all the time. Wikipedia does it easily. Right now I'm copying the wiki table code into MS Word, reversing it year by year by hand, and then pasting it back into the article. If it's 10 items that's no big deal but when I have tennis tournaments that go from 2011 to 1897 that's a ton of time and effort to do. I wish I could make it sortable on wiki, click the year so that it looks the way I want, and then hit edit and have it keep that new order... but wiki doesn't work that way. Has anyone got a better idea for me. Thanks. Fyunck(click) (talk) 03:13, 1 June 2011 (UTC)

Word will sort it for you. Select lines to sort, click on Table->Sort.

For non-Word users, try Notepad++ (freeware). With the TextFX plugin (use Plugins/plugin manager to install) you can use the TextFX tools to sort. >MinorProphet (talk) 14:58, 30 August 2011 (UTC)

Organizing this help page

This page drives me nuts, and probably the 400 others who visit it each day. Nobody wants to fix it up because it's daunting. I have a plan. I'm going to boldly do it, (probably).

The problem:

  • The page (mostly) doesn't flow from basic to more advanced.
  • There is no organized list of code and what it does.

The plan:

  • I will split the whole thing into two sections: ==Basic== and ==Advanced== This should help visitors find basic stuff quickly. I'll start leaving most content in the advanced section, and slowly move basic bits into the basic section.
  • I will try to make a list of code and what it does.

That's the plan. Who knows what will happen. I may abort. Anna Frodesiak (talk) 12:49, 17 August 2011 (UTC)

Yep. I'm aborting for now. It's making me crazy just looking at it. I'll be back (probably). Anna Frodesiak (talk) 13:02, 17 August 2011 (UTC)

May I suggest you prepare something in your user space and propose a discussion on it here before jumping into the deep end. -- Michael Bednarek (talk) 13:47, 17 August 2011 (UTC)
I'm not opposed to the action - as such but I thought I'd point out this chunk of text at the top of the article page {{dablink|For a basic introduction, see [[Help:Wikitable]]. For style considerations, see [[Wikipedia:Manual of Style (tables)]].}}

So it looks like the tables are already split into "basic" help and "not so basic" help - perhaps some stuff should move to the basic help section.

And perhaps this page could be made easier to read by collapsing all the obscure tech details on this page, but leaving the 'basic' tech stuff visible - and having the rest as something like this?

EdwardLane (talk) 05:09, 18 August 2011 (UTC)

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)

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! aqwfyj 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)

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! aqwfyj 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!! aqwfyj Talk/Contribs 11:44, 26 September 2011 (UTC)

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)

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)

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)

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)

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)

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)

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)