如何重新加载dataTable

时间:2017-02-22 05:52:00

标签: javascript jquery ajax datatables

我想在处理之前清空表。它显示错误。

  

无法读取属性' aDataSort'未定义的。

我这样打电话:$('#fulltalktimepdata').dataTable().empty();

 $.ajax({
  type: "POST",
  url: "/recharge_plan/",
  data: {
    'phone_no': phone_no
  },
  dataType: "json",
  success: function(msg1) {
    var fulltalktime_jsonString = msg1.fulltalktime_response_data;
    var fulltalktime_temp_data = JSON.parse(fulltalktime_jsonString);
    var fulltalktime_array_of_arrays = [];
    $.each(fulltalktime_temp_data.data["FTT"], function(i, dataElem) {
      fulltalktime_array_of_arrays.push([dataElem.amount, dataElem.detail, dataElem.validity, dataElem.talktime]);
    });
    console.log(fulltalktime_array_of_arrays);
    $('#fulltalktimepdata').dataTable().empty();
    $('#fulltalktimepdata').DataTable({
      data: fulltalktime_array_of_arrays,
      columns: [{
          title: "AMOUNT"
        },
        {
          title: "DETAIL"
        },
        {
          title: "VALIDITY"
        },
        {
          title: "TALKTIME"
        }
      ]
    });
  }
});
  

无法读取属性' aDataSort'未定义的

0 个答案:

没有答案