Javascript jquery数据表添加行。https://datatables.net
我试图在java脚本数据表()中添加一行 我一直在关注这几页,运气不好 我得到的错误如下所示: 未捕获的TypeError:无法读取未定义的属性“add”Javascript jquery数据表添加行。https://datatables.net,javascript,jquery,datatable,Javascript,Jquery,Datatable,我试图在java脚本数据表()中添加一行 我一直在关注这几页,运气不好 我得到的错误如下所示: 未捕获的TypeError:无法读取未定义的属性“add” 你为什么不试试: ReportTable.row.add(['Test','test','test']).draw(); 因为您已将列名添加到Datatable定义中。将DataTables include脚本替换为以下内容: //cdn.datatables.net/1.10.3/js/jquery.dataTables.min.js
你为什么不试试:
ReportTable.row.add(['Test','test','test']).draw();
因为您已将列名添加到Datatable定义中。将DataTables include脚本替换为以下内容:
//cdn.datatables.net/1.10.3/js/jquery.dataTables.min.js
我猜您使用的是一个过时的版本,它不包括您试图使用的API ReportTable=$(“#ReportsTable”)。dataTable(
必须是
ReportTable=$(“#ReportsTable”)。DataTable(您必须重写到以下内容:
$('#ReportsTable').dataTable({
//"data": Reportdata,
"bLengthChange": false,
"columns": [
{ "data": "name", "sTitle": "Name", "sWidth": "300px"},
{ "data": "type", "sTitle": "Report Type" },
{ "data": "timestamp", "sTitle": "Purchase Date" }
]
});
var ReportTable = $('#ReportsTable').dataTable();
ReportTable.row.add("{name:'Test', type:'test', timestamp:'test'}").draw();
$('#ReportsTable').dataTable({
//"data": Reportdata,
"bLengthChange": false,
"columns": [
{ "data": "name", "sTitle": "Name", "sWidth": "300px"},
{ "data": "type", "sTitle": "Report Type" },
{ "data": "timestamp", "sTitle": "Purchase Date" }
]
});
var ReportTable = $('#ReportsTable').dataTable();
ReportTable.row.add("{name:'Test', type:'test', timestamp:'test'}").draw();