我正在使用来自http://www.datatables.net的 dataTable 插件,我想删除插件的功能并再次应用它,因为我有一个向表添加新行的函数(我添加它是这样的:htmlContent="<tr><td></td>..</tr>", $(myTableBody).append(htmlContent)
) 如果再次将插件应用到我的表中,它会使搜索字段、分页字段等加倍,我只希望旧表有更新,有人可以帮我吗?在 updateTablePlugin 我想更新表格。
$(".tableBody").each(function() {
var tableName = $(this).attr("name");
if (tableName == type) {
$(this).empty();
var contentHTML = "";
for ( var i = 0; i < resourcesJSON.length; i++) {
if (type == resourcesJSON[i].requesttype) {
contentHTML += "<tr>";
contentHTML += "<td>" + resourcesJSON[i].batchid + "</td>";
contentHTML += "<td>" + resourcesJSON[i].responderservice + "</td>";
contentHTML += "<td>" + resourcesJSON[i].requestorservice + "</td>";
contentHTML += "<td>" + resourcesJSON[i].requesttype + "</td>";
contentHTML += "<td>" + resourcesJSON[i].priority + "</td>";
contentHTML += "<td>" + resourcesJSON[i].holdstatus + "</td>";
contentHTML += "<td>" + resourcesJSON[i].sequence + "</td>";
contentHTML += "<td>" + resourcesJSON[i].queuename + "</td></tr>";
}
}
$(this).append(contentHTML);
updateTablePlugin(tableName);
}
});