【发布时间】:2010-04-16 00:33:10
【问题描述】:
我收到了一个 JS 错误,我知道它是什么意思以及如何解决它。 (这里是JS菜鸟)
错误:“tId 未定义”
有错误的 JS 行: "if (s[i].sInstance = tId) { "
更多信息
我正在使用数据表 (http://datatables.net) jQuery 插件。
我有两个表,页面上加载了一个“dataTable”类(在 jQuery UI 选项卡内)。表格按预期呈现,但我在 Firebug 中收到上述错误。
附件是我的数据表配置文件...
$(document).ready(function() {
//Take from: http://datatables.net/forums/comments.php?DiscussionID=1507
// before creating a table, make sure it is not already created.
// And if it is, then remove old version before new one is created
var currTable = $(".dataTable");
if (currTable) {
// contains the dataTables master records
var s = $(document).dataTableSettings;
if (s != 'undefined') {
var len = s.length;
for (var i=0; i < len; i++)
{
// if already exists, remove from the array
if (s[i].sInstance = tId) {
s.splice(i,1);
}
}
}
}
oTable = $('.dataTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bFilter": false
});
});
错误是什么意思,我该如何解决?
【问题讨论】:
-
它准确地告诉你出了什么问题。代码使用的变量 (
tId) 未定义。要解决错误,请定义变量!
标签: javascript jquery datatable