2012-04-24 37 views
0

有一些表格數據可以通過標題進行排序顯示。我爲此使用了Table Sorter插件。每排還有一個可摺疊的面板,可在每排下方打開/關閉。目前我已將這些面板實現爲由jQuery顯示/隱藏的<tr>元素。但是,此實現會導致這些面板的排序以及Table排序器對列進行排序。HTML表格將內容推送到新行而不使用<tr>元素

什麼可以是在每行下方顯示可摺疊面板的替代方法?

回答

0

HTML規範允許多個tbody s在表格中。我認爲你應該爲每行使用1 tbody(它可以有多於1 tr)。

<table> 
    <thead></thead> 
    <tbody> 
    <tr><!-- 1st row with data columns --></tr> 
    <tr><!-- 2nd row which is hidden and with the data that gets shown after expanding --></tr> 
    </tbody> 
    <tbody><!-- similar to the first tbody --></tbody> 
    <tfoot></tfoot> 
</table> 

另外,Tablesorter插件沒有正確實現。嘗試使用它,而不是叉 - https://github.com/renatoalbano/jquery-tablesorter/


編號:https://developer.mozilla.org/en/HTML/Element/table

+0

apnerve:謝謝!儘管[這裏]找到了完美的解決方案(http://stackoverflow.com/questions/218911/getting-jquery-tablesorter-to-work-with-hidden-grouped-table-rows)。 – 2012-04-24 07:04:26

+0

「工作」解決方案。不完美 ;) – apnerve 2012-04-24 07:22:50

相關問題