You can add a custom css class and style it. Example, add the following class to your table table-collapse and remove the table-striped class from the table. Then in your css style it like:
I think that pretty much does it, except for the icon in the expand/collapse button. I’d like the icon to change from a plus to a minus on each row when it’s expanded and back to plus when collapsed. Is there a way to reference the collapsed state of the tr and show/hide icons? Maybe reference the class? Or what would work for that?
I don’t think my example was very helpful - I just copied some code from something I had done before. In principal, could you use dynamic classes like this:
<button id="btn1" class="btn btn-primary" data-toggle="collapse" data-target="#collapse1"> <i class="fal" dmx-class:fa-angle-down="!collapse1.collapsed" dmx-class:fa-angle-right="collapse1.collapsed"></i>
</button>
<div class="collapse" id="collapse1" is="dmx-bs4-collapse">
<p>Collapse body text goes here.</p>
I could see in principal that could work. The id changes for each row, so would have to account for that somehow. I tried just hardcoding the first row, which I assume to be an index of 0, but it doesn’t work.
The tr is: <tr class="collapse" dmx-bind:id="'tr_collapse_order_details'+$index">
I’m missing the “is” in the tr, but when I add it, it breaks it completely - doesn’t expand at all. Without it, it will expand and collapse, but only shows the plus icon.
That means the collapse component has not been added to your page … the is attribute is for wappler components and you need it.
Add a collapse component on the page. It will add the required js files to the page and will also create the required code - which you can copy and paste where needed.