I have a table that's populated from a database which has lots of columns (around 30). A solution someone thought of was to create an accordion out the table, where each row is clickable and will accordion downwards with the rest of the columns worth of information. I am having trouble getting Bootstrap to do this properly for me.
<table class="table table-hover"> <thead> <th></th><th></th><th></th> </thead> <tbody> <tr data-toggle="collapse" data-target="#accordion" class="clickable"> <td>Some Stuff</td> <td>Some more stuff</td> <td>And some more</td> </tr> <tr> <td> <div id="accordion" class="collapse">Hidden by default</div> </td> </tr> </tbody> </table>
As you can see from the jsfiddle, this functionality is not working. Im not really sure what's wrong, and Bootstrap's docs don't go into much detail on collapsing.
Any assistance would be greatly appreciated, thanks!
This seems to be already asked before:
This might help:
Twitter Bootstrap Use collapse.js on table cells [Almost Done]
UPDATE:
Your fiddle wasn't loading jQuery, so anything worked.
<table class="table table-hover"> <thead> <tr> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr data-toggle="collapse" data-target="#accordion" class="clickable"> <td>Some Stuff</td> <td>Some more stuff</td> <td>And some more</td> </tr> <tr> <td colspan="3"> <div id="accordion" class="collapse">Hidden by default</div> </td> </tr> </tbody> </table>
Try this one: http://jsfiddle.net/Nb7wy/2/
I also added colspan='2'
to the details row. But it's essentially your fiddle with jQuery loaded (in frameworks in the left column)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With