gpt4 book ai didi

jQuery 数据表 - 显示表上的行数

转载 作者:行者123 更新时间:2023-12-01 02:53:47 24 4
gpt4 key购买 nike

我的 View 上有一个 jQuery 数据表,并且我使用分页在单个页面上显示 10、20、50 或 100 行。我想在表的某处显示行数。因此,如果我说每页上显示 400 行,按 10 行显示,则消息将显示 400 行中的 1 - 10 行。我似乎找不到如何做到这一点。

解决方案:

(当数据加载到表中时会触发此事件,我可以获取数据长度并将其显示在我想要的位置)

table = $('#MyDataTable').dataTable({
fnDrawCallback": function (oSettings, json) {
console.log('Total row count on load - ', table.fnGetData().length);
},

最佳答案

您需要设置infotrue

$(document).ready(function() {
$('#example').DataTable( {
'info': true
} );
} );

此外,如果您已定义 dom选项,确保字符串中存在字符 i,例如:

$(document).ready(function() {
$('#example').DataTable( {
'dom': 'lfrtip',
'info': true
} );
} );

关于jQuery 数据表 - 显示表上的行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32258896/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com