OL Learn

Merge table cells

Hi
In a detail table, is it possible to merge cells, but make the merge conditional? So certain rows would have merged cells but others would not.

Unless someone else has an idea, the only way I see is to build your detail table dynamically through a script.

Actually, it wouldn’t be a detail table per say, but a static one that would be build from a script. This way you can setup different classes for row that need cell merging and those that don’t. You can then apply the proper colspan to cells.

Of course, you will have to handle the overflow yourself has the pagination process don’t apply to static table.

Hope that helps.

I have experimented with a standard detail table. I created a script to set colspan on certain rows
if (condition){ this.parent().parent().attr(“colspan”,“4”);}
Then I needed another script to remove the extra cells - I found that hiding them was sufficient
if (condition){this.parent().parent().hide();}
Untitled
I assume that the pagination routines will still work (my table will not overflow).

You could try it. Although, if it doesn’t work, you could always try to do your script in a Post-pagination script. This one would be executed after the pagination. The tricky part would be to pinpoint which row you wan to apply your cell merging too.

It works fine. I’ve since found this post with a script from Erik that does essentially the same thing.
The main difference is that I was using a script for each column, whereas Erik’'s uses 1 script per row, so it seems to be significantly faster.