【发布时间】:2017-12-30 11:15:54
【问题描述】:
我正在使用 Jquery 数据表。我得到 f is not defined 控制台错误。 我没有在 Datatables 中使用 ajax 请求。
下面是我的表:
<table id="myTable" class="table table-striped table-bordered dataTable" >
<thead>
<tr>
<th>Trip ID</th>
<th>User Name</th>
<th>From</th>
<th>To</th>
</tr>
</thead>
<tbody>
<tr><td>123231</td></tr>
<tr><td>John</td></tr>
<tr><td>dfshggsf</td></tr>
<tr><td>dsfgfsgfsg</td></tr>
</tbody>
<tfoot>
<tr>
<th>Trip ID</th>
<th>User Name</th>
<th>From</th>
<th>To</th>
</tr>
</tfoot>
</table>
</table>
下面是 Jquery 代码:
$(document).ready(function(){
$('#myTable').DataTable({
'ordering':false,
dom: 'Bfrtip',
buttons:[
{
extend: 'excelHtml5',
title: 'Data export'
},
{
extend: 'pdfHtml5',
title: 'Data export'
},
{
extend: 'csvHtml5',
title: 'Data export'
},
{
extend: 'print',
title: 'Data export'
}
]
});
});
以下是控制台错误:
TypeError: f 未定义 [了解更多] jquery.dataTables.min.js:27:64 jb http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery.dataTables.min.js:27:64 嘎 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery.dataTables.min.js:48:224 e http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery.dataTables.min.js:92:256 米/http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery.dataTables.min.js:92:342 每个 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery-1.12.4.js:370:10 每个 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery-1.12.4.js:137:10 米 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery.dataTables.min.js:82:457 h.fn.DataTable http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery.dataTables.min.js:164:289 http://localhost:8080/RajaRathaDashBoardApp/RajarathaTripHistory:38:4 火 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery-1.12.4.js:3232:11 火与 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery-1.12.4.js:3362:7 准备好 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery-1.12.4.js:3582:3 完全的 http://localhost:8080/RajaRathaDashBoardApp/resources/js/jquery-1.12.4.js:3617:3
请帮我解决这个问题...任何帮助将不胜感激。
【问题讨论】:
-
你是如何导入 jQuery 数据表库的?
-
@yarwest 使用脚本标签,
-
能否提供整个控制台错误?
-
@yarwest TypeError: f is undefined [了解更多] jquery.dataTables.min.js:27:64
-
您是否尝试过将本地文件的导入替换为在线版本? (cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js)
标签: javascript jquery datatables