亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何修復數據表重新初始化

如何修復數據表重新初始化

PHP
冉冉說 2021-05-13 21:19:02
我現在已經修復了好幾天了(準確地說是5天),我得到了這個錯誤。DataTables警告:表ID =活動表-無法重新初始化DataTable。有關此錯誤的更多信息,請參見http://datatables.net/tn/3這是我完整的Jquery代碼,此代碼在將其分離到一個函數中后就初始化了數據表,以便組織起來:$(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"            },我嘗試添加以下內容,但錯誤仍然不斷出現檢索:true銷毀:true有沒有辦法解決這個問題?并同時避免?
查看完整描述

1 回答

?
蕭十郎

TA貢獻1815條經驗 獲得超13個贊

您應該銷毀表并重新初始化

添加此代碼:。

$('#activities-table').dataTable().fnDestroy();

前:

var table = $('#activities-table').DataTable({.....


查看完整回答
反對 回復 2021-05-28
  • 1 回答
  • 0 關注
  • 210 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號