Zero Config jQuery Datatable默认分页不适用于大表
注意事项:Zero Config jQuery Datatable默认分页不适用于大表,jquery,datatables,Jquery,Datatables,注意事项: <table width="100%" align="center" border="0" id="listtable" class="data-table table table-striped table-bordered table-hover table-condensed "> <thead> <tr> <th>Employee</th> <th>E
<table width="100%" align="center" border="0" id="listtable" class="data-table table table-striped table-bordered table-hover table-condensed ">
<thead>
<tr>
<th>Employee</th>
<th>Email</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
... repeat about 5000 times
</tbody>
</table>
$("#listtable").DataTable();
我知道我应该做服务器端分页,ajax加载等,这是另一天的事
问题:
<table width="100%" align="center" border="0" id="listtable" class="data-table table table-striped table-bordered table-hover table-condensed ">
<thead>
<tr>
<th>Employee</th>
<th>Email</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
... repeat about 5000 times
</tbody>
</table>
$("#listtable").DataTable();
我有一个简单的(静态的,硬编码的)表,有3列,大约5000行。我使用zero-config将Datatable
应用于它。分页不起作用。它显示10行,同时实际显示所有内容
HTML:
<table width="100%" align="center" border="0" id="listtable" class="data-table table table-striped table-bordered table-hover table-condensed ">
<thead>
<tr>
<th>Employee</th>
<th>Email</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
... repeat about 5000 times
</tbody>
</table>
$("#listtable").DataTable();
JSFiddle with problem(等待5-6秒,数据表启动):
<table width="100%" align="center" border="0" id="listtable" class="data-table table table-striped table-bordered table-hover table-condensed ">
<thead>
<tr>
<th>Employee</th>
<th>Email</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
<tr>
<td> <a href="aaaaaa" class="txt-reallyred"> xxxxxxx </a> </td>
<td>yyyyyyyy</td>
<td>zzzzzzzzz</td>
</tr>
... repeat about 5000 times
</tbody>
</table>
$("#listtable").DataTable();
查看HTML,关闭并打开
tbody
标记两次
[...] <td>zzzzzzzzz</td> </tr> </tbody> <tbody> <tr> <td> [...]
[…]zzzzzzz[…]
如果使用过滤器输入,您将看到DataTables工作,但仅在第一个tbody
标记中
我可以确认它不起作用#哎呀,复制粘贴错误。对不起,谢谢。我将删除该问题,因为它没有提供任何值。