【问题标题】:Jquery datatable plugin not working on html tableJquery数据表插件不适用于html表
【发布时间】: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


    【解决方案1】:

    你的javascript有什么错误吗?

    或者你的代码有这个?

    <script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min"></script>
    

    【讨论】:

      猜你喜欢
      • 2014-08-23
      • 2013-11-14
      • 1970-01-01
      • 2011-04-12
      • 1970-01-01
      • 1970-01-01
      • 2013-12-30
      • 1970-01-01
      • 2020-11-18
      相关资源
      最近更新 更多