我正在尝试调整由seanmacisaac设置的Jquery可排序、可搜索的表Ref:http://www.seanjmacisaac.com/projects/code/tablesort/#index-member-4
如何将tbody高度设置为固定值。还允许垂直滚动(overflow-y)吗?
<table class="table-sort table-sort-search table-sort-show-search-count">
<thead>
<tr><th class="table-sort">head1</th><th class="table-sort">head2</th><th class="table-sort">head3</th></tr>
</thead>
<tbody>
<tr><td>1-1</td><td>1-2</td><td>1-3</td></tr>
<tr><td>2-1</td><td>2-2</td><td>2-3</td></tr>
<tr><td>3-1</td><td>3-2</td><td>3-3</td></tr>
<tr><td>4-1</td><td>4-2</td><td>4-3</td></tr>
</tbody>
</table>发布于 2014-11-20 20:46:21
只需将表包装到一个div中:
<div style="overflow:auto;height:500px;width:100%">
<table></table> // with any number of row
</div>将css放入一个类,并将一个类添加到容器div
发布于 2014-11-20 20:55:53
如果你只想滚动表格的数据部分,而不是标题,那么你应该让html像这样:
<div class="header-table" style="width:100%">
<table class="header"></table>
</div>
<div class="table-data" style="overflow:auto;height:500px;width:100%">
<table class="data"></table>
</div>发布于 2014-11-20 20:59:01
如果您想在滚动时保持标题不变,对于简单的表格,我创建了两个单独的表:第一个用于标题,第二个在具有固定高度和overflow-y:auto的div中,仅用于tbody。不是很优雅,但只是做好本职工作。
我不知道这个表将放在哪里,但我认为您应该为100+行表使用分页器……
如果问题是排序数据和分页,我会给jqGrid一个机会:http://trirand.com/blog/jqgrid/jqgrid.html
https://stackoverflow.com/questions/27039817
复制相似问题