Collapsable/Expandable Table

Collapsable/Expandable Table

  

So i have a table where the first column displays repeated values on the first column:

However, i would like to avoid that by making the table expandable/collapsable, i.e., show all the related districts and totals to a month all inside one row without displaying repeated months like in the table above. Here's an illustrated example of what i'm looking for:

Is there any widget in the library or any special configuration in the table records widget which allows me to do this?

Hi b_pal,

There's no out of the box solution for this. My take would be to "fake" it by having a Table Row for each entry, but hiding the 2nd and following occurence of a month. The collapse/expand could be handled with a special attribute for each row, some If-s around the Expressions showing the data, and display:none for rows not to be displayed. With Ajax refresh you can expand/collapse.

The first list should contain the available months and on collapse you can have a webblock that will receive that month and calculate those statistics.

Vitor,

That was my first hunch, but as you can see from their example, the OP wants two columns that expand at the same time. Could be solved with Web Blocks but it's a bit tricky and not very performant (since you need to query twice).

Hi Kilian,

I based my response on the description over the image,

"e., show all the related districts and totals to a month all inside one row without displaying repeated months like in the table above."

For this description alone I think my previous reply works well enough.


Best Regards,
Vitor

Vitor,

Yes, both districts and their totals, the totals being in a different column. You can't have a Web Block straddle two columns.

I see your point, and yes, If he wants to keep those columns my solution wont work.


Edit: Although I believe it was just a concept problem, else which info should be displayed when not collapsed? It doesn't make sense.