Skip to content
Fossil Update of ”ticket/59d699710b1ab5d4322568b5a4576f489ffe72d7”
Login

Update of ”ticket/59d699710b1ab5d4322568b5a4576f489ffe72d7”

Overview

Artifact ID: 3e5319dc9c03dffb425c2defef7d28191112caea7189a15a38a44d20a75d03c0
Page Name:ticket/59d699710b1ab5d4322568b5a4576f489ffe72d7
Date: 2025-04-06 15:22:41
Original User: jkosche
Mimetype:text/x-markdown
Parent: d8fdfa89e182ad031fe90c0791cb4d4d19129bdb9d469b39fd23de83cbf1d13e (diff)
Next 2af8d3099a734bdd9914b76bbf9c9b1f43936f905e816f58131cfef4d076a17b
Content

sorttable vs. reports with additional rows

Problem

In reports you can enable additional rows per ticket, by declaring a values name with a leading underscore. The template for new reports includes an example of this.

Reproduction

Create a ticket report with additional rows per ticket. That works by simply using the default ticket report template. Or you can do it yourself by adding fields with a name that starts with an underscore (select x as _x). That is intentional and documented behaviour of the ticket report.

Look at this newly created report and then try to sort it by clicking on any column besides the first. It will do nothing and in the javascripot console you can see an error.

Analysis

If you do such report, then sorttable.js breaks on these additional rows. The reason is, that it tries to access the cell associated with the column that you are currently sorting for. For instance if you sort for the third column, then it tries to read the content of the third cell. But the additional rows use a colspan to only have one cell. So the code accesses a non-existant cell and breaks with the following error:

2:884 Uncaught TypeError: Cannot read properties of undefined (reading 'textContent')
    at SortableTable.sortText (2:884:17)
    at Array.sort (<anonymous>)
    at SortableTable.sort (2:856:9)
    at SortableTable.hdrcell.onclick (2:949:13)
SortableTable.sortText @ 2:884
SortableTable.sort @ 2:856
SortableTable.hdrcell.onclick @ 2:949

Solution

First it is needed to fix the break and make the sorting work at least for the columns with content.

But long-term it would be best if the additional rows are somehow glued to the initial rows and move together with them. That probably means that these additional columns need to be marked in some way, that the Javascript code can detect.