【发布时间】:2011-09-08 06:34:52
【问题描述】:
我正在尝试在我的 play 应用程序中实现 JQuery 数据表。
这是我的代码
#{extends 'main.html' /}
#{set title:'Customers List' /}
<link rel="stylesheet" media="screen" href="@{'/public/stylesheets/demo_table.css'}">
<link rel="stylesheet" media="screen" href="@{'/public/stylesheets/demo_page.css'}">
#{set 'moreScripts'}
<script src="@{'/public/javascripts/jquery-1.5.2.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
<script src="@{'/public/javascripts/jquery.dataTables.js'}" type="text/javascript" charset="${_response_encoding}"></script>
<script src="@{'/public/javascripts/jquery.js'}" type="text/javascript" charset="${_response_encoding}"></script>
<script>
$(document).ready( function() {
oTable = $('#example').dataTable();
});
</script>
#{/set}
<div class="others" align="center">
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Col1</td>
<td>Col2</td>
</tr>
</tbody>
</table>
</div>
当我运行页面时,javascript 会抛出一个错误
$("#example").dataTable is not a function
我检查了所有的 javascript/css 文件。所有文件都包括在内。 可能是什么错误。
【问题讨论】:
-
您的应用是否通过了datatables.net/usage 的所有要求?
标签: jquery playframework datatables