I am writing an application using Data-table plugin. I want to handle the error thrown by plugin by my function but plugin always show a alert box with error message.
我正在编写一个使用数据表插件的应用程序。我想处理我的函数抛出的插件的错误,但是插件总是显示一个带有错误消息的警告框。
In the page load event, I am creating a datatable plugin and registering a handler.
在页面加载事件中,我正在创建一个datatable插件并注册一个处理程序。
function callOnLoad()
{
$.fn.dataTable.ext.errorMode = "none";
auditViewTable = $("#div").on("error.dt",function(e, settings, techNote, message ){
console.log("error");
})
.DataTable({
"processing": true,
"serverSide": true,
"ajax": "getData",
"columns": [
{ "data": "events" },
{ "data": "id" },
{ "data": "name" },
{ "data": "obj_id" },
{ "data": "obj" }
]
});
}
Please help me where I am going wrong.
请在我出错的地方帮助我。
1 个解决方案
#1
10
See the documentation -> http://datatables.net/reference/event/error
查看文档-> http://datatables.net/reference/event/error。
-
error.dt
was first introduced in 1.10.5 !! So you must use at least 1.10.5. Proof of concept : works not, 1.10.4 example / works, 1.10.5 example.错误。dt第一次引入是在1.10.5 !所以至少要用1。10.5。概念证明:无效,1.10.4例/有效,1.10.5例。
-
The correct option to target is
$.fn.dataTable.ext.errMode
.目标的正确选项是$.fn. datatable. ext. errmode。
-
A working example would be using >1.10.4 and
一个有效的示例是使用>1.10.4和
$.fn.dataTable.ext.errMode = 'none';
$('#example').on('error.dt', function(e, settings, techNote, message) {
console.log( 'An error has been reported by DataTables: ', message);
})
#1
10
See the documentation -> http://datatables.net/reference/event/error
查看文档-> http://datatables.net/reference/event/error。
-
error.dt
was first introduced in 1.10.5 !! So you must use at least 1.10.5. Proof of concept : works not, 1.10.4 example / works, 1.10.5 example.错误。dt第一次引入是在1.10.5 !所以至少要用1。10.5。概念证明:无效,1.10.4例/有效,1.10.5例。
-
The correct option to target is
$.fn.dataTable.ext.errMode
.目标的正确选项是$.fn. datatable. ext. errmode。
-
A working example would be using >1.10.4 and
一个有效的示例是使用>1.10.4和
$.fn.dataTable.ext.errMode = 'none';
$('#example').on('error.dt', function(e, settings, techNote, message) {
console.log( 'An error has been reported by DataTables: ', message);
})