当处大数据量时,你可以寻求改善Datatables的运行的速度。使用 deferRender DT 选项,可以做到这一点,让Datatables延迟渲染。
下面的例子可能感受不到这个参数的效果,但是你可以试试大数据量
| Name | Position | Office | Extn. | Start date | Salary |
|---|---|---|---|---|---|
| Name | Position | Office | Extn. | Start date | Salary |
$(document).ready(function() {
$('#example').DataTable( {
"ajax": "data/arrays.txt",
//当处理大数据时,延迟渲染数据,有效提高Datatables处理能力
"deferRender": true
} );
} );
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
Translation from DataTables.net, with permission