| Artifact ID: | a22010cd0f4b5fbf70459d33b5a307a192c345328f30780ae9aa59034c6043f8 |
|---|---|
| Page Name: | ticket/59d699710b1ab5d4322568b5a4576f489ffe72d7 |
| Date: | 2025-04-06 15:04:21 |
| Original User: | jkosche |
| Mimetype: | text/x-markdown |
| Next | d8fdfa89e182ad031fe90c0791cb4d4d19129bdb9d469b39fd23de83cbf1d13e |
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.
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.