Template talk:Static row numbers/Archive 1

Archive 1

User:Timeshifter/Sandbox144

Jts1882. See User:Timeshifter/Sandbox144. I do ctrl-f5 on Firefox whenever I want to see the latest changes on that page.

I just happened to be up for your latest css edits, and saw the hash disappear. Thanks.

I also noticed that the row number cell borders disappeared on the table with just class=mw-datatable. That is a class that sometimes gets used by itself.

Also the row number borders disappeared when there is no mediawiki table class. See the last tables on the sandbox page.

And some weirdness on the last tables. The number "1" showed up in the row number header. --Timeshifter (talk) 07:24, 29 April 2021 (UTC)

Thanks Jts1882. As you know, your last CSS edit put borders around the row number cells when using class=mw-datatable by itself without class=wikitable. --Timeshifter (talk) 08:46, 29 April 2021 (UTC)
Jts1882. It looks like your latest edit got rid of all problems in desktop view. Thanks again. Now only mobile view is a problem, and only when class=sortable is used.
I edited and updated my note here:
Phabricator T233340. Add sortability to sortable tables for readers of the mobile web site.
--Timeshifter (talk) 06:49, 30 April 2021 (UTC)
The sortable class can be used to create two blocks in desktop. Unfortunately, the mobile view ignores the sortable class functionally but it is still there to affect the css styling. I don't know how or where the mobile view prevents the functionality so have no clues about how to identify when in mobile view. It would be nice if templatestyles had some conditional loading to allow a different .css file for mobile.
An alternative method would be to identify tr elements with th content rather than td content. This can be done with JS, but not purely with css. A css :has() selector (as in JQuery) is being discussed but there is reluctance to introduce it for some reason.
So it looks like we need an update from Wikimedia (allowing sortable tables on mobiles) or from the CSS-gods (a :has() selector), unless there is some other way of detecting when in mobile view. —  Jts1882 | talk  07:27, 30 April 2021 (UTC)
Jts1882. I added a link pointing here from the Phabricator thread. --Timeshifter (talk) 09:43, 30 April 2021 (UTC)
Jts1882. Thanks! It looks like it is fixed! Whatever CSS magic you used seems to have removed the number out of the header cell. I updated my Phabricator note. I suggested they look at the CSS adjustments you made, and that it may help in fixing some of the problems involved in adding sortability to the mobile view. --Timeshifter (talk) 10:07, 1 May 2021 (UTC)
I asked at Wikipedia:Village pump (technical) and the .skin-minerva class was suggested as a flag for mobile view. If it's the only mobile skin then it will work. I don't think this solution has anything to do with Phabricator T233340, though, as that is about the mobile view using the sortable class. The problem here is the inconsistency with how wikipedia deals with tables, sometimes using thead (with sortable on desktop) and sometimes not (without sortable and with it on mobile).
There is still a problem for tables with multiple header rows. They will be fine in sortable tables in desktop, but only the first header row will be handled correctly in mobile. I added a class for a second row that seems to work. I'm wondering if the template should be paired with a closing template the way {{rank}} was. This would allow a parameter |header-rows=n and could set appropriate classes in a wrapper element. —  Jts1882 | talk  10:47, 1 May 2021 (UTC)
When the developers work on implementing sortable on mobile, I think this info may be useful to them. They will have to sort out the inconsistencies you mentioned. Plus I read that the connections between sortable and collapsing tables/elements are causing problems.
Currently, all the tables at User:Timeshifter/Sandbox144 are editable in the visual editor (VE). That is not possible with {{rank}}. So I would prefer whatever method you find that works with the Visual Editor. If multiple rows are a problem, and fixing it would prevent VE use on the table, then I suggest creating a second template just for multi-header-row tables. --Timeshifter (talk) 11:18, 1 May 2021 (UTC)
Fair enough. Standalone is simpler. I think the template should say it is designed to be used with the wikitable and sortable classes and results without these classes may be unpredictable. It will also need a warning about multiple header tables and the mobile view. A header row at the foot of the table might also need handling. —  Jts1882 | talk  11:35, 1 May 2021 (UTC)

(unindent). Here is an article with multi-row headers at both the top and bottom of the various tables:

I need to do some tests with that table in a new sandbox. I would love a template to add integrated row numbers to it. The {{rank}} row numbers are unwieldy because of the need to use nowrap. Also, the need for breaks in the header text to maintain an exact number of rows. I prefer using style=max-width over breaks <br> for header text width.

If I have to do without visual editing for multi-row headers, I don't mind. There would be none of the many row-alignment problems with {{rank}}. So a second template for that would be great. With or without visual editing. And with or without {{End}}. --Timeshifter (talk) 12:18, 1 May 2021 (UTC)

See: User:Timeshifter/Sandbox147.
I saw your note about adding class=static-row-headers to bottom headers.
So I guess we will not need another template for multi-row headers.
--Timeshifter (talk) 14:39, 1 May 2021 (UTC)
I forgot to check mobile view when I worked on sandbox 147. I see now that for multi-row headers it is necessary to add class=static-row-headers for every header line, top and bottom. --Timeshifter (talk) 14:46, 1 May 2021 (UTC)

I was bold and redirected the CSS talk page here

See redirect: Template talk:Static row numbers/styles.css

Hope no one minds. :) --Timeshifter (talk) 22:59, 2 May 2021 (UTC)

Option

Jts1882: How about adding this as an option to {{Aligned table}}? That'd be an easy way to deploy it widely ({{Aligned table}} is used in nearly 10,000 pages) — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 22:31, 2 May 2021 (UTC)

Looking at the use of {{Aligned table}} it is mainly used within other templates, so nested in other HTML elements. 10,000 is a lot of pages where something unexpected could happen. While it could simply added as an option, e.g. |static-row-number-column=yes, is there a particular need? —  Jts1882 | talk  13:33, 3 May 2021 (UTC)
Ha! You're right--I thought it was an alternate wikitable template. I see now it's mostly used in sidebars.
Haviing said that... Would there be room for an alternate wikitable template using templatestyles to fix some of wikitable nuisances (or simply as a candidate replacement to the default format)? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 00:31, 4 May 2021 (UTC)

Merged ranks

Jts1882, do you think there's any way this templatestyle could identify merged cells across rows, and merge the rank accordingly. The motive is that in some pages, editors seem very competitive and are very attached to the rank column, and want to make sure ranks accurately reflect ties (e.g. List of oldest living people, Supercentenarians in the United States). — Guarapiranga  02:06, 29 July 2021 (UTC)

I don't think that is possible. The CSS only looks at position of elements in the DOM tree, not the content. This sort of thing needs to be handled my the Wikimedia software, which uses Javascript for the sorting and could add the rank column with more flexibility. —  Jts1882 | talk  08:22, 29 July 2021 (UTC)
How about removing the top border of static-row-header class index cells, or even adding a static-row-tie class without the top cell border that nonetheless adds to the row counter anyway? I tried that here, but failed miserably  Guarapiranga  07:39, 30 July 2021 (UTC)

static-row-numbers-norank

See diff.

Jts1882. Is this used like class="sorttop static-row-header" is used here?:

Date July 1 July 8 July 15 July 22 July 29
World 3,946,801 4,002,350 4,059,250 4,128,200 4,190,059
Days to double 172 178 182 187 192
Countries, territories 210 210 210 210 210
  Afghanistan 4,962 5,477 5,983 6,325 6615
  Albania 2,456 2,456 2,456 2,456 2457

I substituted in class="sorttop static-row-numbers-norank"

Date July 1 July 8 July 15 July 22 July 29
World 3,946,801 4,002,350 4,059,250 4,128,200 4,190,059
Days to double 172 178 182 187 192
Countries, territories 210 210 210 210 210
  Afghanistan 4,962 5,477 5,983 6,325 6615
  Albania 2,456 2,456 2,456 2,456 2457

I prefer the new class name since some rows that shouldn't have a row number are not header rows (as above). Some rows at the bottom of tables too. Rows that total data, and so on. Maybe we could remove class=static-row-header from the template CSS?

I could do a search for it, and substitute the new class name. See search:

56 results in article space. --Timeshifter (talk) 10:11, 3 September 2021 (UTC)

Yes it's used as a class on a row, just like static-row-header. I think static-row-header should be used for clarity (making it clear it refers to a header row). Iirc, it's also needed for the background colour on headers apart from the top row in some skins. —  Jts1882 | talk  10:25, 3 September 2021 (UTC)
Also note the difference on borders for the multiple header rows. —  Jts1882 | talk  10:37, 3 September 2021 (UTC)
Jts1882. Can you give me an example page with such a table? And what skin? In the above tables in Firefox in the new Vector skin (default setting) I see a white background on all the cells in the 2nd, 3rd, and 4th static rows in both tables. But those are all data cells, not header cells. --Timeshifter (talk) 14:27, 3 September 2021 (UTC)
The difference in the borders in the static rank column can be seen in the above examples (mobile view is also slightly different). I was referring to the background colour of the static rank column for header rows. I might be misremembering as so many things were tried. Or it might have been the different background colours for wikitable and datatable, which no longer matters. Regardless, I still think a class that explicitly refers to the header is useful for clarity. —  Jts1882 | talk  16:08, 3 September 2021 (UTC)
Jts1882. I see now the borders per cell in the top cells of the row numbers column. They disappear when sorting is done. It doesn't matter to me either way whether the blank individual cells have borders or not.
What exactly did you create static-row-numbers-norank for?
Non-header rows like the ones in the above tables?
--Timeshifter (talk) 16:23, 3 September 2021 (UTC)
It was a response to a request not to include some territories in the numbered rankings (e.g. Falklands and French Guyana in South American lists). I assumed you asked this question because you had seen the discussion at Talk:List of South American countries by population#Remove numbering for French Guiana and Falkland Islands. Whether this is desirable is another question, which can be discussed at the talk pages, but the option is now there. —  Jts1882 | talk  17:05, 3 September 2021 (UTC)
Jts1882. I had not seen that discussion. Thanks for creating the class. I am going to use it for most rows that don't need a row number. It is easier to remember for me. I will keep an eye out for problems with various skins, etc.. Some header rows need bottom alignment of the header text. In that case I will use {{Static row numbers header}} --Timeshifter (talk) 18:37, 3 September 2021 (UTC)
@Jts1882 Could you consider expanding the docs with these two examples and explaining how they work? Thanks for creating this. I've been using increasingly by the day! — DaxServer (talk to me) 09:34, 14 October 2021 (UTC)

Row hover highlighting

Jts1882. I was wondering if we could add row hover highlighting to styles.css:

class=mw-datatable is disappearing from skins. See:

Krinkle created Template:Import-blanktable. It adds hover and a white background.

But I can't figure out an easy way to incorporate that into this template:

It can be incorporated, but then it requires this at the top of tables:

{{Static row numbers}}{{Import-blanktable}}
{| class="wikitable sortable static-row-numbers tpl-blanktable"

or this:

{{Static row numbers}}{{Import-blanktable}}
{| class="wikitable sortable static-row-numbers" style="text-align:right;"

I want row hovering to work with just this:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers"

I don't want to add the white background to {{Static row numbers}}. Some people don't like it, and may not use {{Static row numbers}} because of it.

But I haven't seen anybody opposed to row hovering. It makes following rows across tables a lot easier. Especially on wide tables.

I can add the white background to {{Static row numbers table}}. I already tested it here:

It works fine, and the white background doesn't override colors set for rows or cells. It will replace class=mw-datatable in that template.

So if people want both row hovering and a white background they can use this:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers" style="text-align:right;"

Currently over a hundred tables use {{Static row numbers table}}. Up until recently they got row hovering and a white background due to mw-datatable. --Timeshifter (talk) 19:40, 12 August 2021 (UTC)

Wouldn't the simplest thing be to replace class=mw-datatable with another class, say class=srn-datatable, and add the following to {{Static_row_numbers/styles.css}}.
              .srn-datatable {
                   background: #fff;
               }
               .srn-datatable tr:hover {
                   background: #eaf3ff;
               }
Alternatively the hover css could be added for class static-row-numbers so hover works on all instances of the template. —  Jts1882 | talk  06:31, 13 August 2021 (UTC)
After thinking about it more, I don't remember hearing from anybody that actually disliked the white background after seeing it in use. Some people were just hesitant beforehand.
So I would like both the hover and the white background added for class static-row-numbers. That way hover and the white background works on all instances of the template. Without having to remember to add class=srn-datatable also.
I did some tests of Krinkle's template, {{Import-blanktable}}. It respects the background colors written for cells or for rows. I don't understand though why it respects the background colors set for rows, but class=mw-datatable does not.
So maybe adding the CSS directly to class static-row-numbers will work too. Versus adding it to a separate class srn-datatable --Timeshifter (talk) 14:04, 13 August 2021 (UTC)
How about testing it with a custom class srn-datatable and then making the more general change for class static-row-numbers if there is consensus?
On the respecting background colours set in rows it might depend on the order of the CSS on the page or the order the classes are added to the table (I can never remember which). It's also possible an !important was used (although I assume not for wikimedia software). —  Jts1882 | talk  14:48, 13 August 2021 (UTC)
Suggested code above added for class srn-datatable. I've tested a few examples by changing mw-datatable to srn-datatable in edit mode in some pages using {{static row numbers}}. I've also change Module:Country population as can be seen in List of South American countries by population. Can you check some more pages? —  Jts1882 | talk  15:04, 13 August 2021 (UTC)

(unindent). Jts1882. Thanks. I did some tests here:

class=srn-datatable works fine in all the sandbox152 tables. It does not override background colors whether set for a row or for individual cells.

But it does nothing when substituted for mw-datatable within {{Static row numbers table}}. Tables using that template show no changes. For example, in Bauxite. I reverted my test change when done.

It causes no hovering when placed before or after {{Static row numbers table}} in Bauxite. It messes up the table when placed after. It does nothing when placed before.

I did the same test after temporarily removing mw-datatable from {{Static row numbers table}}. Same results for the Bauxite tests.

I did ctrl-F5 before and after all these tests. I am using Firefox, new vector (default in preferences), and Windows 10 Pro in a desktop PC.

Can you run a temporary test to see if attaching hover and a white background to {{Static row numbers}} works in the tables in User:Timeshifter/Sandbox152? If it works for colored rows and cells without problems, then I think we have enough consensus to keep it in. You, Guarapiranga, and I like it. And it may be the only way it will work with {{Static row numbers table}}. See if it works in Bauxite.

And the Phabricator thread said we should use templatestyles for now instead of mw-datatable. --Timeshifter (talk) 17:54, 13 August 2021 (UTC)

It works for me in the User:Timeshifter/Sandbox152 tables, highlighting without overriding applied cell colours.
Changing class=mw-datatable to class=srn-datatable in {{Static row numbers table}} also works, tested with Bauxite. I tried all four skins and they all showed the highlighting.
Incidentally, you can add <templatestyles src="Template:Static row numbers/styles.css" /> to {{Static row numbers table}} so you don't need to use both templates as in Bauxite. —  Jts1882 | talk  09:04, 14 August 2021 (UTC)
Thanks Jts1882. I added <includeonly><templatestyles src="Template:Static row numbers/styles.css"/></includeonly> to {{Static row numbers table}}. I also changed to srn-datatable inside that template. See diff. I checked a few articles using it. And a few skins. Hover with white background is working in all.
I also tested that template in edit mode in all the tables here:
User:Timeshifter/Sandbox152
I substituted {{Static row numbers table}} for the existing wikitext in the top lines of all the tables.
Hover with white background worked in all. And it did not override cell or row colors.
What do you think of my idea of making hover with white background the default in {{Static row numbers}}?
Without having to use class=srn-datatable in the wikitext of tables not using {{Static row numbers table}}.
Since most tables have only one header row most people don't need, or want to use, or figure out, the additional templates:
And they won't have to figure out class=srn-datatable
The only thing they would have to do is add {{Static row numbers}} and class=static-row-numbers for most tables with one header row.
Maybe someday it will be incorporated into the Mediawiki software and the only thing necessary would be this:
class=static-row-numbers
And maybe the Mediawiki software could automatically do the work of all the additional templates too.
More discussion:
https://phabricator.wikimedia.org/T287997#7283236
--Timeshifter (talk) 17:14, 14 August 2021 (UTC)
I think the row highlighting on hover is a good feature for all tables, so I'd favour including that automatically, i.e. adding the CSS to class static-row-numbers. I'm undecided on the white background.
The white background with mw-datatable overrides the normal colour schemes of the skins. With it being deprecated, more tables will be following the skin defaults, unless {{Import-blanktable}} gets used as widely. I'm not even sure what the advantage of the white background was. —  Jts1882 | talk  06:43, 15 August 2021 (UTC)

(unindent). We could go with row highlighting on hover as default in Template:Static row numbers. And class=srn-white as an option. class=srn-datatable would no longer be needed.

I tried using background-color:white; and background:white; in Template:Static row numbers table tests. Neither worked. Overall background color remained gray.

Both worked when added directly into the table wikitext at User:Timeshifter/Sandbox152 during edit mode tests. And it did not override cell or row background colors.

So we could add class=srn-white to Template:Static row numbers table. I am fairly certain that would work since class=srn-datatable added a white background without problems.

I keep my monitor at a lower brightness to protect my eyes since I use my computers all the time. So this makes table backgrounds on or off Wikipedia slightly gray. I find the additional default gray background of class=wikitable to be annoying. Especially in country lists with blue country links on a gray background. --Timeshifter (talk) 13:44, 15 August 2021 (UTC)

I've added the hover CSS to class static-row-numbers and added code for white background under class srn-white-background (I think it better to have more specific names).
I'll leave it to you to decide whether to add srn-white-background to {{Static row numbers table}}.
If your concern is the contrast for when you have your monitor on low brightness, you can customise your common.css file (i.e. at User:Timeshifter/common.css). You could add the white background to all wikitables by putting it on class wikitable.—  Jts1882 | talk  14:49, 15 August 2021 (UTC)
Thanks again, Jts1882. I added srn-white-background to {{Static row numbers table}}.
I tested in edit mode at User:Timeshifter/Sandbox152.
The white background and hover showed up without overriding the cell and row background colors.
I looked at tables and graphs at the popular free site Our World in Data. They use hover and a white background. For example, look at the table tabs here:
https://ourworldindata.org/covid-deaths
--Timeshifter (talk) 21:37, 15 August 2021 (UTC)

Apparently <templatestyles src="Template:Static row numbers/styles.css"/> is no longer needed in this template. Someone removed it, and so I tested to see if hover and white background was still working. It is. --Timeshifter (talk) 17:23, 22 October 2021 (UTC)

Replace # symbol

Hey, per the guideline at MOS:NUMBERSIGN a "#" symbol should not be used in place words. Instead {{abbr|No.|Number}} or similar should be used. Pinging @Jts1882 for the small chance you aren't watching this talk page. Gonnym (talk) 18:27, 24 March 2022 (UTC)

@Gonnym: Using {{abbr|No.|Number}} would be a good solution. Unfortunately, the row numbers and headers are set using CSS, so there is no option for using a template with an explanation (at least one I can think of). The default is no heading. The # is added by using the class static-row-header-hash. The options (not mutually exclusive) seem to be:
  • Remove support for static-row-header-hash. With a class explicitly saying hash I don't think it a good idea to substitute an alternative as that would be confusing.
  • Add support for static-row-header-text to add for "No." or even make this default .
  • Do nothing until Wikimedia provide an alternative. A # is widely used for the header in tables, despite MOS.
Ultimately this template is a temporary measure until there is a Wikimedia solution for automatically numbering table rows. A Wikimedia solution could use JS and make it more flexible, use tooltips, and generally make it easier to use. What do you suggest? —  Jts1882 | talk  09:04, 25 March 2022 (UTC)
I have very little experience with CSS so not sure if this could work, but would it be possible to add <abbr title="Number">No.</abbr> to the content property? Regarding option two (static-row-header-text) that sounds good but I'm not completely sure how you envisioned it. Can you give an example? Gonnym (talk) 10:12, 25 March 2022 (UTC)
The following is a test table for class static-row-header-text. —  Jts1882 | talk  13:15, 25 March 2022 (UTC)
ColA ColB
a b
c d
That looks good! (just noticed it still doesn't use abbr which I guess isn't possible, but that is still better than #). --Gonnym (talk) 11:35, 27 March 2022 (UTC)
The content css only allows plain text. Any html such as abbr just gets displayed literally. I did try and experiment with a hidden element and hover but couldn't get it to work with prefix. This is something that could easily be done in javascript, which means an opt-in user script or a Wikimedia solution. The latter is what is needed. —  Jts1882 | talk  12:28, 27 March 2022 (UTC)

Only count data rows and not header rows mid-table

Can the CSS be modified to only count and number rows (tr) that are data rows (td) and not header rows (th) of type "col"? Some tables use column header mid-table like below:

{{Static row numbers}}
{| class="wikitable static-row-numbers static-row-header-text"
! ColA !! ColB
|-
| a || b
|-
! scope="col" colspan="2" | test
|-
| c || d
|}
ColA ColB
a b
test
c d

Gonnym (talk) 22:56, 18 May 2022 (UTC)

Like that?
ColA ColB
a b
test
c d
Guarapiranga  02:38, 19 May 2022 (UTC)
That can work too. Thanks! Gonnym (talk) 06:45, 19 May 2022 (UTC)
ColA ColB
a b
x y
c d
The class static-row-header also works on normal rows to prevent count and numbering. —  Jts1882 | talk  07:33, 19 May 2022 (UTC)

Was there a way to skip numbers?

I don't mean skip rows; I mean leap numbers.
Also: how does on v-align the number on the top again? Cheers. Guarapiranga  06:03, 7 June 2022 (UTC)

Now there is! Guarapiranga  00:15, 21 June 2022 (UTC)

Vertical-align changes

Guarapiranga. Please see:

I fail to see what that last diff by MZMcBride has anything to do with my edit, Timeshifter. S/he's talking about vertical alignment of the No. table header; my change was on the vert align of the actual numbers, so that editors could set it to be whatever fits the page they're editing. — Guarapiranga  09:11, 22 June 2022 (UTC)
Let's ask MZMcBride. MZMcBride added vertical-align: middle;
You Guarapiranga changed it to vertical-align: inherit;
In the same spot in the CSS. I think you are both changing the vertical alignment of the numbers in the row number column.
MZMcBride also changed the padding of the "No." table header. So MZMcBride changed 2 things.
So I am asking both of you which one of the vertical alignments is better, and why. Middle versus inherit.
Guarapiranga. Your edit summary was "let editors dictate vertical align, not force middle".
How would a table editor set the vertical alignment of the numbers in the row number column? Where would the inherit setting get its alignment from?
--Timeshifter (talk) 11:20, 22 June 2022 (UTC)
I assume it would be inherited from the table or row. I would like to see an example of where middle was necessary. I think we want the same vertical alignment for the row number as the other cells in the row, so why set it at all? —  Jts1882 | talk  11:52, 22 June 2022 (UTC)

Jts1882 Since the row number column does not exist in the wikitext I was wondering how an editor would set anything for it, or its header.

Here below is part of a table (from Demographics of Pakistan#Largest cities) with and without "No." as the header. style=vertical-align:bottom is in the header row in the table in the article.

{{Static row numbers}}
{|class="wikitable sortable static-row-numbers" style=text-align:right 
|+
|-class=static-row-header style=vertical-align:bottom
! width="100" |City Name
! width="100" |Province or Territory
! width="100" |2017 Population
! width="100" |1998 Population
! width="100" |Avg. Annual Growth Rate
|-
 | style="text-align:left;" |[[Karachi]]
 | style="text-align:left;" |{{Flag|Sindh}}
 |14,884,402
 |9,339,023
 |{{Increase}} 2.48%
|}
City Name Province or Territory 2017 Population 1998 Population Avg. Annual Growth Rate
Karachi   Sindh 14,884,402 9,339,023   2.48%

Add class=static-row-header-text to get "No." as the header:

City Name Province or Territory 2017 Population 1998 Population Avg. Annual Growth Rate
Karachi   Sindh 14,884,402 9,339,023   2.48%

I don't know how to sandbox a change back to vertical-align: inherit; (or not set it at all as you Jts1882 suggested) in the CSS. Maybe someone else can test this and point me to the test. To see how it effects the above table.

With and without style=vertical-align:bottom in the header row. To see if it inherits it.

As an aside, I was Googling for info, and found this interesting stuff:

--Timeshifter (talk) 17:38, 22 June 2022 (UTC)

Since the row number column does not exist in the wikitext I was wondering how an editor would set anything for it
By setting the CSS formatting on the row in the wikitext (neither html, CSS or wikitext accept column formatting anyway, btw, bc tables are basically structured as rows of cells). — Guarapiranga  21:01, 22 June 2022 (UTC)
Guarapiranga. Maybe you can test that theory in a template sandbox? By removing the vertical-align setting altogether as suggested by Jts1882. Then we can see if the Pakistan table header "No." takes on the setting from this row setting:
|-class=static-row-header style=vertical-align:bottom
--Timeshifter (talk) 22:48, 22 June 2022 (UTC)
Change Template:Static row numbers/sandbox/styles.css and use {{Static row numbers/sandbox}}. Edit: I see Guarapiranga just set those files up today. —  Jts1882 | talk  08:17, 23 June 2022 (UTC)

Sandbox version

Here is the table with the sandbox template.

{{Static row numbers/sandbox}}
{|class="wikitable sortable static-row-numbers static-row-header-text" style=text-align:right 
|+
|-class=static-row-header style=vertical-align:bottom
City Name Province or Territory 2017 Population 1998 Population Avg. Annual Growth Rate
Karachi   Sindh 14,884,402 9,339,023   2.48%

"No." is in the middle of vertical alignment. Sandbox CSS is currently not set with vertical-align at all. --Timeshifter (talk) 09:55, 23 June 2022 (UTC)

Careful with these tests as there are two versions of styles.css setting the CSS and they are not independent classes. I've add aa section so the sandbox version can be tested in isolation in editor mode. —  Jts1882 | talk  10:20, 23 June 2022 (UTC)
If you look at the sandbox version in editor mode both the header (with No.) and numbered rows are top aligned. However in the saved page the non-sandbox version sets the vertical align to middle. Not sure why as I thought the last loaded styles.css would set the CSS for all tables. —  Jts1882 | talk  10:25, 23 June 2022 (UTC)
I noticed editor preview and parsoid sometimes differ on how they process css. — Guarapiranga  00:46, 24 June 2022 (UTC)
If you add vertical-align: middle; to the sandbox version and test this section in edit mode, then the header is middled as expected, but the row numbers are still top aligned. I also noted that inherit gives an error/warning so is not an accepted value in the Wikimedia sanitised CSS. —  Jts1882 | talk  10:33, 23 June 2022 (UTC)

Jts1882. Typo was messing up vertical alignment of headers. See:

I assume it was a typo. Or was that a way to remove it temporarily? --Timeshifter (talk) 10:51, 23 June 2022 (UTC)

Jts1882. See diff of where you added the typo (?). To see more clearly what I am talking about.
Maybe we need a sandbox2, sandbox3, etc. for this stuff so that we can keep the tests intact. --Timeshifter (talk) 23:22, 23 June 2022 (UTC)
Nothing precludes that. — Guarapiranga  00:49, 24 June 2022 (UTC)

I'm having difficulty following this conversation, but I was focused on making the table headers at Wikipedia:Database reports/Unused templates/1 look consistent with my edit. --MZMcBride (talk) 18:19, 23 June 2022 (UTC)

Mobile issue with sortable

Sortable now works on the mobile site. When using the "sorttop" class with this template, the topmost numbered row losses its number after sorting on mobile (see discussion). Example table: [1]. Jroberson108 (talk) 02:54, 6 July 2022 (UTC)

Even without using "sorttop" and before sorting, the first row on mobile isn't numbered while the desktop version is, which may be more relevant to the underlying issue. Compare: desktop vs mobile. Jroberson108 (talk) 02:59, 6 July 2022 (UTC)

If I remember correctly, the mobile view was handled differently because HTML tables in mobile didn't use <thead> blocks for the header row and the header had to be treated as the first row of <tbody>. Now the sortable table on mobile uses a <thead> block, so there need to be some changes such as replacing .skin-minerva CSS with .skin-minerva:not(.sortable) and other changes to qualify :not(.skin-minerva) CSS. It would be much easier if all mobile tables used the <thead> block. —  Jts1882 | talk  11:09, 6 July 2022 (UTC)
I may have misremembered. Looking at the styles.css it's the .sortable class that introduced use of the <thead> block in desktop view. Mobile had to be treated differently because it ignored .sortable and never used <thead>. Now it might be possible to simplify and just handle .sortable. There may not be any reason to have seperate CSS for the mobile view now. —  Jts1882 | talk  11:52, 6 July 2022 (UTC)
Looks like your change to styles.css fixed the issue. Jroberson108 (talk) 12:10, 6 July 2022 (UTC)
Oops, I thought I was editing the sandbox, but it does seem to have worked so I'll leave it. There are a few other things to check but they are rarely used and/or cosmetic. —  Jts1882 | talk  12:14, 6 July 2022 (UTC)

The issue is not resolved, as I checked initial example on Android based smart phone today. --Arjunaraoc (talk) 09:22, 5 August 2022 (UTC)

@Arjunaraoc: The "World" row uses the "sorttop" class and is sorted above the rest without a row number on both desktop and mobile versions both before and after sort, so it appears to be working correctly. I am also using Android. Are you experiencing something different? Jroberson108 (talk) 12:35, 5 August 2022 (UTC)
@Jroberson108, Thanks for the clarification. I realized that Styles.css is outdated on Telugu Wikipedia resulting in the issue. I have updated it and it works fine there too. Arjunaraoc (talk) 23:28, 5 August 2022 (UTC)

Install guide

I've created a Template:Static_row_numbers page in a local wiki. But any table that I try to get the row numbers on ends up with the contents of the template and then the table. Pretty sure I've not got the template set up right but I can't seem to find a good list of steps needed to get this working. Anybody got a list of steps or guide to installing this template and then using it in pages on a locally installed MediaWiki 1.37.2? BiloxiGeek (talk) 15:13, 6 December 2022 (UTC)

The template uses templatestyles (see WP:TSTYLE) to apply CSS styling from {{Static_row_numbers/styles.css}}. So you need the css file and also to have templatestyles installed on the wiki (it might not be in the default installation; see Extension:TemplateStyles]). If you provide a link I can have a look. —  Jts1882 | talk  17:17, 6 December 2022 (UTC)
I do have the TemplateStyles extension already. I've copied the Template:Static_row_numbers/styles.css contents to a similarly named file in my wiki. It looks like I also copied that styles.css into Template:Static_row_numbers, but I'm not sure why. Now that I look I can't figure out which contents should be in the Template:Static_row_numbers page. BiloxiGeek (talk) 17:53, 6 December 2022 (UTC)
I can't give out a link to my MW install, it's behind a firewall that I can't adjust. BiloxiGeek (talk) 18:01, 6 December 2022 (UTC)
I think I got other problems as well. I noticed that wfLoadExtension( 'TemplateStyles' ); was commented in LocalSettings.php, so I uncommented that and now I can't get any wiki page to load. As soon as I comment that line all goes back to normal. BiloxiGeek (talk) 18:19, 6 December 2022 (UTC)
Fixed that problem (file ownership). When I save what I think should be in the template I get Script error: No such module "documentation".
Template:Static row numbers contains:
<includeonly><templatestyles src="Template:Static row numbers/styles.css" /></includeonly><noinclude> :::::{{Documentation}}</noinclude> :::::
Did I copy the wrong contents maybe? BiloxiGeek (talk) 18:26, 6 December 2022 (UTC)
That looks like the right content for Template:Static row numbers and should work if templatestyles is installed correctly and you have Template:Static_row_numbers/styles.css.
The script error suggests you haven't copied "Template:Static row numbers/doc". You could just remove the noinclude block with {{Documentation}} for testing. —  Jts1882 | talk  09:11, 7 December 2022 (UTC)
I've just checked that I got "Template:Static row numbers/doc", "Template:Static row numbers/styles.css" and "Template:Static row numbers/doc" all copied into my wiki. Still get this just above the table that I'm trying to use it in:
Page Template:Static row numbers/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "wikitext").
So I understand the error and I'm looking into changing the content model for the page but that special page is saying there's errors that I can't interpret. It says:
Missing selector list at line 1 character 1.
Invalid selector list at line 40 character 1.
Missing selector list at line 42 character 1.
Are those errors in the template or the page itself? BiloxiGeek (talk) 14:55, 9 December 2022 (UTC)
@BiloxiGeek: I remember having problem with the content model not being "Sanitized CSS". Go to the CSS file page and select "Page Information" from the left hand menus. There is a table with a "Page content model" row, which has an option to "change". Make sure the page has the "Current content model" as "sanitized-css". —  Jts1882 | talk  20:55, 9 December 2022 (UTC)
For some reason I couldn't change the model. So I gave it try on a separate MW install on a completely different system and still had issues. Enabled the TemplateData extension and it started working. I'm not 100% sure that was actually the fix though, had a few other changes going on around that time. On the system where I was really wanting this working I went through an upgrade to MW 1.39, reconfig, ensured at all the same extensions were enabled and I've got it working now. Thanks for the help. 128.160.42.110 (talk) 13:00, 10 December 2022 (UTC)

Docs page. Quotes are not needed unless there is a space in the value

Gonnym. Quotes are not needed unless there is a space in the value. Look it up. And it's simpler. See: KISS principle. And: MOS:SIMPLIFY.

Note the history on the docs page. I have done a lot of editing on it. And though I don't own the page, I would appreciate if you would not revert without discussion and consensus. This has been previously discussed on the table talk pages. Where we have discussed this template too. --Timeshifter (talk) 15:33, 3 May 2023 (UTC)

See current discussion at Help talk:Table. --Timeshifter (talk) 00:36, 4 May 2023 (UTC)

Thank you for creating!

Thank you so much for creating this, this fills a big hole in many pages. Greenman (talk) 18:42, 16 June 2021 (UTC)

What they said :) — Asdfjrjjj (talk) 04:33, 7 September 2023 (UTC)