Last modified: 2014-03-01 17:08:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40911, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38911 - [Tablesorter] Headers with rowspan should be considered for all rows
[Tablesorter] Headers with rowspan should be considered for all rows
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.22.0
All All
: Low enhancement (vote)
: ---
Assigned To: Derk-Jan Hartman
https://commons.wikimedia.org/w/index...
:
Depends on:
Blocks: 31601
  Show dependency treegraph
 
Reported: 2012-08-01 09:20 UTC by Michael M.
Modified: 2014-03-01 17:08 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael M. 2012-08-01 09:20:01 UTC
This is hard to describe. I hope the example at https://commons.wikimedia.org/w/index.php?title=Commons:Sandbox&oldid=75246712 explains, what I want to say.

As far as I understand currently the code looks for the header row with most cells, to decide which cells can be clicked to sort the table (function buildHeaders). But it should look at the row with the most *columns*, i.e. count cells after considering rowspan (which is somewhat contrary to bug 31420).

With a header like

{| class="wikitable sortable"
!rowspan="2" | Jahr!!rowspan="2" | Gewinner!!rowspan="2" |  Nationalität!!colspan=5|Score
|-
! R1 !! R2 !! R3 !! R4 !! Total
|-

not only the columns labeled R1 to Total (in the second row) should be sortable, but also the first three columns, which span over two rows and currently aren't considered as there cells belong to the first row.

My example shows a workaround for this:

{| class="wikitable sortable"
! style="border-bottom: hidden;" | !! style="border-bottom: hidden;" | !! style="border-bottom: hidden;" | !! colspan=5|Score
|-
! Jahr !! Gewinner !! Nationalität !! R1 !! R2 !! R3 !! R4 !! Total
|-

which just adds an invisible cell in the first row, and moves the header in the second row. But the text should be centered vertically, and the whole header (both rows) should be clickable.
Comment 1 Derk-Jan Hartman 2013-04-25 09:31:24 UTC
The buildHeaders() function should take into account rowspan when calculating 'longest' TR and collecting the TH's cells that will get the sorter added, for this to work. Simple test case:


{| class="wikitable sortable" border="1" 
|-
! rowspan=2 | name
! colspan=2 | Data columns
|-
! data
! more data
|-
| cats
| 273
| 53
|-
| dogs
| 65
| 8,492
|-
| mice
| 1,649
| 548
|}
Comment 2 Gerrit Notification Bot 2013-04-25 15:50:10 UTC
Related URL: https://gerrit.wikimedia.org/r/60871 (Gerrit Change I172c3a610b28498334f80a7808663bab7fb0466c)
Comment 3 Michael M. 2013-04-26 09:30:31 UTC
(In reply to comment #0)
> This is hard to describe. I hope the example at
> https://commons.wikimedia.org/w/index.php?title=Commons:
> Sandbox&oldid=75246712
> explains, what I want to say.

Now at [[commons:User:Schnark/tablesorter]] (ignore the red links/templates, it's just about which columns should be sortable).
Comment 4 Derk-Jan Hartman 2013-04-26 10:09:52 UTC
@Michael, tested that case with my change, and it works as desired.
Comment 5 Bartosz Dziewoński 2013-07-01 15:41:53 UTC
Fixed by DJ. Yay!
Comment 6 Gerrit Notification Bot 2013-07-01 15:43:25 UTC
Change 60871 merged by jenkins-bot:
jquery.tablesorter: Support sortable column headers with rowspans

https://gerrit.wikimedia.org/r/60871
Comment 7 Timeshifter 2013-10-06 14:04:02 UTC
The last fix does not work in this case: 
*[[Help talk:Sorting]] - see section "Sorting not working with complex headers".

{| class="wikitable sortable"
|-
! rowspan="2" | name
! colspan="2" | Data columns
! rowspan="2" | Another column
|-
! data
! more data
|-
| cats
| 273
| 53
| 1
|-
| dogs
| 65
| 8,492
| 2
|-
| mice
| 1,649
| 548
| 3
|}
Comment 8 Bartosz Dziewoński 2013-12-08 22:37:40 UTC
Timeshifter, patch for bug 53211https://gerrit.wikimedia.org/r/#/c/98250/ – should fix that as well.
Comment 9 Bartosz Dziewoński 2014-03-01 17:08:11 UTC
(It has been merged now, at last.)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links