【发布时间】:2015-06-08 19:23:33
【问题描述】:
我正在尝试使用 DataTable 插件向我的 html 表添加功能。我按照 datatables.net 的安装和初始化步骤进行操作,但它没有向我的 html 页面添加任何功能。我想知道是否是因为我的表格以插件不支持的方式格式化。任何输入都会很有用。非常感谢!
这是我的代码:
<!DOCTYPE html>{% load staticfiles %}
<script>
$(document).ready(function() {
$('#detailTable').DataTable();
});
</script>
<!-- <link rel="stylesheet" type="text/css" href="{% static 'inventory/detailStyle.css' %}" />-->
<h1>{{ inventory.inventory_name }}</h1>
<table cellpadding="1" cellspacing="1" id="detailTable">
<thead>
<th>NAME</th>
<th>STATUS</th>
<th>DERIVATIVES</th>
<th>SUBSYSTEMS</th>
</thead>
<tbody>{% for block in inventory.block_set.all %}
<tr>
<td>{{ block.block_name }}</td>
<td>{{ block.block_status }}</td>
<td>{{ block.block_derivatives }}</td>
<td>{{ block.block_subsystems }}</td>
</tr>{% endfor %}</tbody>
</table>
<div> <a href="{% url 'inventory:requests' inventory.id %}">Request Form</a>
</div>
【问题讨论】:
标签: jquery html jquery-plugins datatable