我是 jQuery 新手,如果我的问题太简单,很抱歉。
我正在尝试做这样的事情:
$("#send-one").html('done. ');
var tableProgress= $("<table id='table-progress'><tr><td></td></tr></table>");
$("#send-one").empty().append(tableProgress);
tableProgress.dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
});
这一切都发生在 jQuery ui Dialog Box 内部.
它不起作用,我认为这是因为 .dataTable() pluggin找不到表格,所以我尝试使用 jQuery $.when .
错误是这样的
Uncaught TypeError: Cannot read property 'asSorting' of undefined
我需要的是:在插入 $("#send-one").html('done.' + tableProgress)
的表中使用 .datatable 插件,但是,使用 .datatable () 直接可能与插入不同步。
我也尝试过:
$("#send-one").html('done. ' + tableProgress);
$('#table-progress').dataTable();
最佳答案
另一个堆栈溢出问题有一个更清晰的答案,它必须有一个 <thead>
和一个 <tbody>
上类:
Jquery datatable integration error?
你的两个都没有。
关于jQuery 数据表 : Uncaught TypeError: Cannot read property 'asSorting' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17321974/