我正在尝试使用datatables插件,但在调用函数dataTable()时出错.我的代码看起来像这样:
@Scripts.Render("~/Scripts/DataTables-1.9.4/media/js/jquery.js")
@Scripts.Render("~/Scripts/DataTables-1.9.4/media/js/jquery.dataTables.js")
<script type="text/javascript">
$(function () {
$('#tableID').dataTable();
});
</script>
<table class="table table-striped table-hover table-bordered" id="tableID">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1</td>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Row 2</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我可以在Firebug中看到错误:
TypeError: $(...).dataTable is not a function
$('#tableID').dataTable();
Run Code Online (Sandbox Code Playgroud)
在Firebug中我可以看到包含的jquery.dataTables.js文件,但函数dataTable()不起作用.