当前位置:网站首页>Datatables屏蔽报错弹窗
Datatables屏蔽报错弹窗
2022-06-29 06:38:00 【Yuan_mingyu】
Datatables屏蔽报错弹窗
在使用ajax为datatables获取数据时,如果数据为空,会出现这样的alert提示
DataTables warning: table id=xxx - 未查找到相关内容
由于此时datatables表格中会有类似于没有找到匹配结果的文字信息,所以这个弹窗就没有必要了。
下面代码可以屏蔽掉弹窗,改为在console中打印提示信息,或添加其他处理办法
$.fn.dataTable.ext.errMode = 'none'; //屏蔽掉报错弹窗
$('#example') //初始化datatables
.on( 'error.dt', function ( e, settings, techNote, message ) {
//接收并打印错误信息,也可自行添加相应处理方法
console.log( 'An error has been reported by DataTables: ', message );
} )
.DataTable();
边栏推荐
- Vite quick start
- Flutter is configured with a domestic image and connected to the real machine
- List collection implements paging
- The annual technology inventory of cloud primitives was released, and it was the right time to ride the wind and waves
- 消息队列之通过队列批处理退款订单
- As a qualified network worker, you must master DHCP snooping knowledge!
- Mongostat performance analysis
- jetson tx2
- 国内代码托管中心- 码云
- Illegal forward reference and enums
猜你喜欢

json tobean

消息队列之通过幂等设计和原子锁避免重复退款

Baidu applet automatically submits search

多模态 —— Learnable pooling with Context Gating for video classification

QT program packaging and publishing windeployqt tool

NoSQL数据库之Redis(一):安装 & 简介

Introduction to NoSQL database

Analysis on the wave of learning robot education for children

你真的懂 “Binder 一次拷贝吗“?

施工企业选择智慧工地的有效方法
随机推荐
How to fix Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorli
Li Kou daily question - day 30 -1523 Number of bit 1
package.json的所有配置项及其用法,你都熟悉么
Idea common plug-ins
电子商务盛行,怎么提高商店转换率?
转:侯宏:企业数字化转型的关键不是技术,而是战略
NoSQL数据库之Redis(四):Redis的发布和订阅
[C language] flexible array
Open source 23 things shardingsphere and database mesh have to say
Qt 串口编程
QT program packaging and publishing windeployqt tool
Qt 处理图像数据的类区别(QPixmap、QImage、QPicture)
Message queue avoiding repeated refund by idempotent design and atomic lock
Idea use
To: Hou Hong: the key to enterprise digital transformation is not technology, but strategy
Genicam gentl standard ver1.5 (3) Chapter 4
CI工具Jenkins安装配置教程
Labor skills courses integrated into steam Education
QT custom bit operation class
VerilogA - dynamic comparator