我不知道如何将我当前的响应式和固定头等服装功能与显示“全部”列表功能合并,就像在此https://datatables.net/examples/advanced_init/length_menu.html
中那样我不知道该怎么做,这是我当前的功能
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
var table = $('#example').DataTable({
responsive: true,
paging: false,
columnDefs: [{
searchable: false,
orderable: false,
targets: 0,
}],
order: [
[1, 'asc']
],
});
new $.fn.dataTable.FixedHeader(table);
table.on('order.dt search.dt', function() {
table.column(0, {
search: 'applied',
order: 'applied'
}).nodes().each(function(cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
});
</script>
我无法将功能与JavaScript中显示“所有”页面长度菜单合并,请提供帮助。 还请允许我运行js片段 谢谢
答案 0 :(得分:0)
var table = $('#example').DataTable({
responsive: true,
paging: false,
// Add this line
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
columnDefs: [{
searchable: false,
orderable: false,
targets: 0,
}],
order: [
[1, 'asc']
],
});
new $.fn.dataTable.FixedHeader(table);