1
2
3
4
5
6
7
8
9
10
11
12
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
+
+
+
+
+
+
+
+
|
# 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>)
|