[英]jQuery Datatables resume after AJAX call completed
I am using the Datatables plugin for jQuery, and I am trying to figure out how to resume the script once the AJAX call was successfull. 我正在使用jQuery的Datatables插件,并且试图弄清楚一旦AJAX调用成功后如何恢复脚本。
My current code is: 我当前的代码是:
var table = $("#dataTables-example").DataTable(
{
ajax: {
url: "/kleurmixer/hmi/view_json2.php?type=2",
dataSrc: '',
},
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 7 ] },
{ 'bSortable': false, 'aTargets': [ 8 ] }
]
}
);
Now, in Chrome and FF it works. 现在,在Chrome和FF中可以使用。 But since this is a page made for WinCC (which uses IE7), it doesn't work.
但是由于这是为WinCC(使用IE7)制作的页面,所以它不起作用。 So I need some kind of callback function for my AJAX call, but I can't figure out how to do it.
因此,我需要某种回调函数来进行AJAX调用,但是我不知道该怎么做。
Help would be appreciated, 帮助将不胜感激,
Thanks, 谢谢,
You could create a callback for done
or success
like this. 您可以像这样为
done
或success
创建回调。 You could also add error
and statusCode
if you need that. 如果需要,您还可以添加
error
和statusCode
。
var table = $("#dataTables-example").DataTable(
{
ajax: {
url: "/kleurmixer/hmi/view_json2.php?type=2",
dataSrc: '',
"done": function(){
alert('done');
}
},
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 7 ] },
{ 'bSortable': false, 'aTargets': [ 8 ] }
]
}
);
Update 1: Another datatable approach 更新1:另一种数据表方法
$("#dataTables-example").dataTable( {
"initComplete": function(settings, json) {
alert( 'DataTables has finished its initialisation.' );
}
} );
Documentation for Datatables initComplete 数据表initComplete的文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.