【发布时间】:2013-08-31 15:08:09
【问题描述】:
我在 ASP.NET 和 UpdatePanel (scriptManager) 中使用 Jquery Datatable。 我有以下错误:
DataTables 警告(表 id = 'tbVerificationApplicant'):不能 重新初始化 DataTable。
要检索此表的 Datatables 对象,请不传递任何参数或 请参阅 bRetrieve 和 bDestroy 的文档
这是创建表的 Jquery 文件:
function DatatablesExec() {
$('#tbVerificationApplicant').dataTable({
'bProcessing': true,
'bServerSide': true,
"sPaginationType": "full_numbers",
'sAjaxSource': 'listVerificationData.ashx?ddlStatusValue=' + $("#ddlStatusClient option:selected").text(),
"fnDrawCallback": function () {
$('#tbVerificationApplicant tbody tr').click(function () {
var hRef = $("td:eq(0)", this).text();
document.location.href = 'frm_VerifyIdentity.aspx?ID=' + hRef;
});
}
});
}
$(document).ready(function () {
/* Initialise the DataTable */
DatatablesExec()
});
但是,为了避免在我更改下拉列表后表格消失,我在 web 表单后面的代码中添加了下面的下一个代码。
protected void Page_Prerender(object sender, EventArgs e)
{
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "_function_dummyname", "<script type='text/javascript'>DatatablesExec();</script>", false);
}
}
它运行良好,但在开始时会出现一个带有此错误的弹出窗口。
这是网络表单的一部分:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlStatusClient" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<table id="tbVerificationApplicant" class="display">
<thead>
【问题讨论】:
标签: jquery datatables