-
Notifications
You must be signed in to change notification settings - Fork 433
Colspans in columntoggle mode #221
Comments
AFAICT tablesaw doesn't support rowspans or colspans in the data. Colspans in the headers are respected, however. Taking a look at initCells (as of 2.0.3) you can see that Tablesaw scans the table headers and then assigns the cells in the rows that correspond to each header to be toggled on or off later. Unfortunately the assignment algorithm ignores any colspans in the data. If you were to change your footer to look like this: <tfoot>
<tr>
<td>Always here</td>
<td colspan="2">Total</td>
<td>150</td>
</tr>
</tfoot> Then I'd expect that toggling off the Budget column would hide the total column in the footer, but that the Actual column would have no effect on it (probably it would instead hide the 150 cell in the footer). I adjusted the assignment algorithm to allow colspans in the data, but with the caveat that a cell with a colspan in the data can't cross multiple columns in the header. I'll submit a PR or something so that others can take advantage of it. Your problem is thornier because instead of simply hiding or showing cells you'd have to adjust the colspan of your data cells on the fly. Taking a look at issue #48 you can see that other people have the reverse requirement (complex colspans and row spans in a multirow header). I can't see a way to provide the functionality that would satisfy both of you without a creating a comprehensive model of the table (as opposed to just assigning a group of cells to a single column header) and increasing the complexity of the toggling algorithm. |
I opened #225 for the simple case that I described above. |
Thank you very much! I will take a deeper look when I return from vacation. |
#225 has been merged and is available in the early 3.0 betas |
Hi, and thanks for your great work on tablesaw :)
Is it possible to get the table to behave correctly when using colspans? Here is an example:
What will happen when I toggle one of the columns off, is that colspan will still occupy three cells, even though it "should" only take two.
I'm aware that it is a bit complex – because which colspan should you take one cell from in case there were several cells with colspans?
Well, just wanted to ask if this is something you have solved before?
The text was updated successfully, but these errors were encountered: