[datatables杂记] sAjaxSource 数据源 Search 后 fnInitComplete 不执行。
var oTable = $('#div_list').dataTable({ "oLanguage": {//语言国际化 "sUrl": "/Admin/corescript/jquery.dataTable.cn.txt" }, "sPaginationType": "bootstrap", "bProcessing": true, "bServerSide": true, "sAjaxSource": DuoMi.ADProject.RequestUrl + "GETPROJECTLIST", "fnInitComplete": function () { alert(1) } });
惊奇的发现,如果Search数据后 fnInitComplete 不会执行!
攻破方法:借助
fnServerData
"fnServerData": function (sSource, aoData, fnCallback, oSettings) { oSettings.jqXHR = $.ajax({ "dataType": 'json', "type": "POST", "url": sSource, "data": aoData, "success": function (json) { fnCallback(json); //这里。。。。 } }); }