[英]How to integrate DataTables jQuery plug-in with this setup?
I have a HTML div that is fed a JSON output formatted as a HTML table when a function is called: 我有一个HTML div,当调用一个函数时,该div被馈送为格式化为HTML表的JSON输出:
<div id="content"></div>
JS: JS:
$.ajax({
url: "script.php",
type: "POST",
dataType:'json',
data: dataString,
cache: false,
success: function(data){
var htmlStr = '';
htmlStr += '<table id="summary-table">'
... // appends table content to htmlStr
$("#content").html(htmlStr);
}
})
After setting the content, then call datatables on the table in question: 设置内容后,然后在有问题的表上调用数据表:
$("#content").html(htmlStr);
$('#summary-table').dataTable({...});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.