我想實現Datatables jQuery插件與我的HTML表,但沒有運氣。我鏈接到CSS樣式和Datatables腳本本身的Datatables CDN,同時鏈接到Google託管的jquery插件。我也有一個腳本的本地Javascript文件來初始化我桌子上的數據表。我去打開html頁面,只是得到我的普通表,就好像DataTable甚至沒有運行。我可能做錯了什麼?DataTables jquery插件不工作,得到一個空白頁?
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="datatables.js"></script>
<table id="mytable">
<table>
<thead>
<tr>
<th>High-Level Category</th>
<th>Device Type</th>
<th>Hostname</th>
<th>IP Address</th>
<th>Owner</th>
<th>Organizational Unit</th>
<th>Organizational Unit Email</th>
<th>Universal Forwarder or Syslog?</th>
<th>In PCI?</th>
<th>Notes</th>
</tr>
</thead>
<tbody contenteditable>
<tr>
<td contenteditable="true">SECDEV1</td>
<td contenteditable="true">Firewall</td>
<td contenteditable="true">Description 1</td>
<td contenteditable="true">1.1.1.1</td>
<td contenteditable="true">Kim</td>
<td contenteditable="true">Information Technology</td>
<td contenteditable="true">[email protected]</td>
<td contenteditable="true">Syslog</td>
<td contenteditable="true">Yes</td>
<td contenteditable="true">notes</td>
</tr>
<tr>
<td contenteditable="true">SECDEV2</td>
<td contenteditable="true">Switch</td>
<td contenteditable="true">description2</td>
<td contenteditable="true">2.2.2.2</td>
<td contenteditable="true">Bob</td>
<td contenteditable="true">Information Networking</td>
<td contenteditable="true">[email protected]</td>
<td contenteditable="true">Syslog</td>
<td contenteditable="true">NO</td>
<td contenteditable="true">more notes</td>
</tr>
</tbody>
本地的js文件我有如下:
$(document).ready(function(){
$('#mytable').dataTable();
});
任何幫助將是巨大的。
謝謝!
爲什麼都datatables.js和DataTable min.js.刪除datatables.js。 – Ranjan
datatables.js是初始化DataTables的本地JavaScript腳本。那是datatables.min.js從Datatables CDN做些什麼? – Zach
兩者都是相同的,但min.js是縮小版本。只需刪除它並檢查它。 – Ranjan