Creating Accordion Table with Bootstrap

后端 未结 3 1799
长发绾君心
长发绾君心 2020-12-13 02:14

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 ro

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 02:54

    In the accepted answer you get annoying spacing between the visible rows when the expandable row is hidden. You can get rid of that by adding this to css:

    .collapse-row.collapsed + tr {
         display: none;
    }
    

    '+' is adjacent sibling selector, so if you want your expandable row to be the next row, this selects the next tr following tr named collapse-row.

    Here is updated fiddle: http://jsfiddle.net/Nb7wy/2372/

提交回复
热议问题