【发布时间】:2017-01-04 00:34:59
【问题描述】:
我有一个 fiddle 可以对 URL 进行 ajax 并呈现一个表格,但我想在页面加载期间延迟并仅加载 10 行。
HTML
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Account ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
</table>
JS
$(document).ready(function() {
$('#example').DataTable( {
"bPaginate": true,
"processing": true,
"bServerSide": true,
ajax: {
url: 'https://api.myjson.com/bins/1egsx',
dataSrc: 'data'
},
columns: [
{ data: 'account_id' },
{ data: 'name' },
{ data: 'email' }
],
"deferRender": true,
"deferLoading": 10,
} );
});
我一直得到
没有找到匹配的记录
【问题讨论】:
-
你的意思是
iDisplayLength? -
我的意思是
deferLoading,iDisplayLength会做什么? -
iDisplayLength只显示所需的行数 -
我认为@DestinatioN 明白了。
标签: javascript jquery html datatables