【发布时间】:2019-05-08 07:12:53
【问题描述】:
我正在使用 jQuery 数据表(jQuery 版本:jquery-3.1.1.min.js)。我需要打印表中的所有数据(在我的场景中,我有 56 行,每页 10 条记录,然后变成 6 页)。但它只打印数据的一部分(36 条记录)。但我也有 pdf 功能。它工作正常。当点击 pdf 按钮时,它会生成包含所有重新编码的 pdf
<script type="text/javascript" src="<c:url value='/static/js/jquery-3.1.1.min.js' />"></script>
<script src="<c:url value='/static/js/dataTables/jquery.dataTables.min.js' />"></script>
<script src="<c:url value='/static/js/dataTables/dataTables.buttons.min.js' />"></script>
<script src="<c:url value='/static/js/dataTables/buttons.print.min.js' />"></script>
<script>
$(document).ready(function(){
$('#adTable').DataTable({
dom: 'Bfrtip',
buttons: [
'pdf', 'print'
]
});
});
</script>
<table id="adTable" class="table table-hover">
<thead>
<tr>
<th>Index</th>
<th>Subject</th>
<th>Category</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<c:forEach var="obj" items="${list}" varStatus="loop">
<tr>
<td>${loop.index+1}</td>
<td>${obj.subject}</td>
<td>${obj.category}</td>
<td>${obj.status}</td>
</tr>
</c:forEach>
</tbody>
</table>
【问题讨论】:
标签: javascript jquery html datatables jquery-pagination