我使用Datatables来管理从我们的数据库打印的行。我已将行设置为每页5行,但这会导致我的引导标签出错。
我正在使用的JS:
<script type="text/javascript">
$(document).ready(function() {
$("#feedback-table").dataTable({
"bRetrieve": false,
"bFilter": false,
"iDisplayLength": 5,
"bLengthChange": false,
"bJQueryUI": true,
"aoColumns": [
{ sWidth: '35%' },
{ sWidth: '20%' },
{ sWidth: '30%' },
{ sWidth: '15%' } ]
});
feedback-table.dataTable().fnDraw();
});
我尝试点击引导标签时出现的错误:
Uncaught ReferenceError: feedback is not defined home:281
Error in event handler for 'undefined': Error calling method on NPObject. Error: Error calling method on NPObject.
at chrome-extension://mkfokfffehpeedafpekjeddnmnjhmcmk/docstart.js:1:2117
at Event.dispatchToListener (event_bindings:356:21)
at Event.dispatch_ (event_bindings:342:27)
at Event.dispatch (event_bindings:362:17)
at <error: illegal access>
at Event.dispatchToListener (event_bindings:356:21)
at Event.dispatch_ (event_bindings:342:27)
at Event.dispatch (event_bindings:362:17)
at Object.chromeHidden.Port.dispatchOnMessage (miscellaneous_bindings:273:22)
由于
答案 0 :(得分:0)
您应该将dataTable
设置为变量并调用fnDraw
像这样:
var myTable = $("#feedback-table").dataTable({
"bRetrieve": false,
"bFilter": false,
"iDisplayLength": 5,
"bLengthChange": false,
"bJQueryUI": true,
"aoColumns": [
{ sWidth: '35%' },
{ sWidth: '20%' },
{ sWidth: '30%' },
{ sWidth: '15%' } ]
});
myTable.fnDraw();