[英]How to change Pagination Size
我正在嘗試更改表格的分頁大小
默認值為 10,25,50,100 但我想將其更改為 15、30、50、全部
在我的表格中,我使用分頁並在頁腳中搜索我的代碼
<script type="text/javascript">
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#example tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="'+title+'" />' );
} );
// DataTable
var table = $('#example').DataTable({
initComplete: function () {
// Apply the search
this.api().columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change clear', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
}
});
} );
</script>
如何將條目大小更改為 15、30、50 和所有
[...Array(countPages).keys()].map(num => <button key={num}
className={page === num ? "selected" : ""}
onClick={() => setPage(num)}>{num + 1}</button>)
只需使用 lengthMenu 配置來設置自定義頁面大小
var table = $("#example").DataTable({
lengthMenu: [[15, 30, 50, 100], [15, 30, 50, 100]],
initComplete: function () {
...
} );
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.