https://datatables.net/examples/server_side/simple.html

當頁面上要顯示的數據在10萬筆以上時,可以使用server-side processing. 這樣在change entries, paging, sorting的時候,會通過事先定義好的ajax去backend重新取得數

RadGridTable = $('#tbNKeywords')
.on( 'processing.dt', function ( e, settings, processing ) {
// paging or sorting .etc processing or not,
// processing will be true if processing finished.
$('#loading_overlay').css( 'display', processing ? 'block' : 'none' );
})
.on('xhr.dt', function ( e, settings, json, xhr ) {
// Ajax call back, add some code here...
if (json == null || json["success"] == false) {
$('#loading_overlay').css( 'display', 'none' );
}
})
.on( 'draw.dt', function () {
// check all rows if select-all checked
if($(".select-all").is(":checked")) {
CheckedAll = 1;
RadGridTable.rows().select();
} // reset select checkbox by saved selected row ids
RadGridTable.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
if (AllSelectedRowIds.includes(this.id()))
this.select();
} );
})
.on( 'page.dt', function () {
if (CheckedAll == 1)
return; // save selected row id when paging
var selectedRowIds = RadGridTable.rows( { selected: true } ).ids();
for (i = 0; i < selectedRowIds.count(); i++)
{
if (!AllSelectedRowIds.includes(selectedRowIds[i]))
AllSelectedRowIds.push(selectedRowIds[i]);
}
})
.on( 'click', 'tbody tr', function () {
if (CheckedAll == 1)
return false;
})
.DataTable({
"columns": [
{ "data": null },
{ "data": "Created_Date" },
{ "data": "xxxxxxxx" },
{ "data": "xxxxxxxx" },
{ "data": "xxxxxxxx" },
{ "data": "xxxxxxx" },
{ "data": "xxxxxxx" }
],
columnDefs: [{
orderable: false,
className: 'select-checkbox',
targets: 0,
data: null,
defaultContent: ''
}],
select: {
style: 'multi',
selector: 'td:first-child'
},
order: [[ 1, 'desc' ]],
"paging": true,
"searching": false,
colReorder: false,
fixedHeader: true,
"processing": true,
"serverSide": true,
rowId: 'KeywordId',
     "language": {
"infoFiltered": "" // remove "(filtered from x total entries)" part from datatable footer information.
},
"dom": '<"top"flp<"clear">>rt<"bottom"ip<"clear">>',
"ajax": {
"url": "/common/service/xxxxxxxxHandler.ashx",
"type": "POST",
"data": function (d) {
d.action = "xxxxxxxxx";
d.data = JSON.stringify(xxxxxxx);
d.Id = <%=Id%>;
}
}
});

define dataTable頁面上的一些文字部分

https://datatables.net/reference/option/language

例如: 不想要顯示 "(filtered from x total entries)" 在 footer的部分

$(document).ready(function() {
$('#example').DataTable( {
"language": {
"infoFiltered": ""
}
} );
} );

最新文章

  1. CentOS7中DHCP配置
  2. AndroidLinker与SO加壳技术之下篇
  3. 浅谈Jquery中的bind(),live(),delegate(),on()绑定事件方式
  4. Sprite的原点
  5. Java学习第五篇:二进制(原码 反码 补码),位运算,移位运算,约瑟夫问题
  6. C#系列之String和StringBuilder
  7. 用Android-X86和VirtualBox打造高性能Android开发环境
  8. Java基础知识强化77:正则表达式之获取功能(Pattern 和 Matcher类的使用)
  9. 有关ios中images.xcassets的导入图片等命名问题
  10. 利用Python实现一个感知机学习算法
  11. VBA编程的工程性规划
  12. mongdb单节点安装方法
  13. java之Spring(IOC)注解装配Bean详解
  14. @vue-cli3创建项目报错:ERROR command failed: npm install --loglevel error --registry=https://registry.npm.taobao.org --di
  15. Centos6.5系统关闭防火墙
  16. Linux-硬件
  17. proc:基本数据库操作
  18. vs2010下使用sqlite
  19. Java使用HttpClient上传文件
  20. 自己开发Visual studio插件-一个nvelocity高亮插件

热门文章

  1. 2019-2020-1 20199302《Linux内核原理与分析》第六周作业
  2. Vue的响应式系统
  3. vs 在高分屏下开发 winform 配置
  4. RegularExpression正则表达式
  5. Windows系统错误处理机制
  6. Qt智能指针QPointer, QSharedDataPointer ,QSharedPointer,QWeakPointer和QScopedPointer
  7. LibreOJ #108. 多项式乘法
  8. Pytest权威教程-更改标准(Python)测试发现
  9. Pytest权威教程21-API参考-04-钩子(Hooks)
  10. log4g:站在巨人的头上实现一个可配置的Go日志库