我現(xiàn)在已經(jīng)修復了好幾天了(準確地說是5天),我得到了這個錯誤。DataTables警告:表ID =活動表-無法重新初始化DataTable。有關此錯誤的更多信息,請參見http://datatables.net/tn/3這是我完整的Jquery代碼,此代碼在將其分離到一個函數(shù)中后就初始化了數(shù)據(jù)表,以便組織起來:$(document).ready(function() { initialize_table();});function initialize_table(){ var salesman = $("#salesman-filter").val(); var supervisor = $("#supervisor-filter").val(); var startdate = $("#start-date").val(); var enddate = $("#end-date").val(); var columns = [ { "width": "80px", "targets": 0 }, { "width": "200px", "targets": 1 }, { "width": "200px", "targets": 2 }, { "width": "200px", "targets": 3 }, { "width": "200px", "orderable": false, "targets": 4 }, { "width": "200px", "targets": 5 }, { "width": "100px", "targets": 6 }, { "width": "110px", "targets": 7 }, { "width": "150px", "orderable": false, "targets": 8 }, { "width": "150px", "orderable": false, "targets": 9 }, { "width": "150px", "orderable": false, "targets": 10 }, { "width": "150px", "orderable": false, "targets": 11 }, { "width": "150px", "orderable": false, "targets": 12 } ]; var table = $('#activities-table').DataTable({ "serverSide": true, "bprocessing": true, retrieve: true, "ajax": { url: "activities-data.php", type: "POST", data: {salesman:salesman, startdate:startdate, enddate:enddate, supervisor:supervisor}, error: function(data){ console.log(data); } }, "columnDefs": columns, "language": { "emptyTable": "No data found", "zeroRecords": "No data found", "info": "Showing <b>_START_</b> to <b>_END_ of _TOTAL_</b> entries", "paginate": { "first": "First", "last": "Last", "next": "Next", "previous": "Previous" },我嘗試添加以下內(nèi)容,但錯誤仍然不斷出現(xiàn)檢索:true銷毀:true有沒有辦法解決這個問題?并同時避免?
1 回答

蕭十郎
TA貢獻1815條經(jīng)驗 獲得超13個贊
您應該銷毀表并重新初始化
添加此代碼:。
$('#activities-table').dataTable().fnDestroy();
前:
var table = $('#activities-table').DataTable({.....
- 1 回答
- 0 關注
- 206 瀏覽
添加回答
舉報
0/150
提交
取消