【问题标题】:Why do I have a JS error "i is undefined jquery.datatables.min.js" [closed]为什么我有一个 JS 错误“我是未定义的 jquery.datatables.min.js”[关闭]
【发布时间】:2019-12-02 14:16:44
【问题描述】:

这是我的 HTML/twig:

<table
    class="table table-striped"
    data-toggle="datatable"
    data-number-rows-display=5
>
    <thead>
        <tr>
            <th data-exportable="true" data-sortable="true">Nom</th>
            <th data-exportable="true" data-sortable="true">Prénom</th>
            <th data-exportable="true">Téléphone fixe</th>
            <th data-exportable="true">Téléphone portable</th>
            <th></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        {% for individual in people %}
            <tr>
                <td class="align-middle">{{ individual.lastname }}</td>
                <td class="align-middle">{{ individual.firstname }}</td>
                <td class="align-middle"><div class="phone">{{ individual.homePhoneNumber }}</div></td>
                <td class="align-middle"><div class="phone">{{ individual.cellPhoneNumber }}</div></td>
                <td class="align-middle column-action">
                    <a
                        href="{{ path('people_edit', { 'id': individual.id }) }}"
                        class="btn btn-secondary"
                        data-toggle="modal"
                        data-target="#information-people-{{ individual.id }}"
                        >
                        <i class="icon ion-md-repeat"></i>&nbsp;Relancer
                    </a>
                </td>
            </tr>
        {% endfor %}
    </tbody>
</table>

我使用data-toggle="datatable" 来切换我数组上的DataTable。

我的 javascript 控制台向我发出警告 i is undefined jquery.datatables.min.js。我不明白这是什么意思以及如何解决它。

【问题讨论】:

    标签: jquery html datatables twig


    【解决方案1】:

    通过W3C validator 传递我生成的HTML 后,我发现&lt;th&gt;&lt;td&gt; 多(6 个&lt;th&gt; 5 个&lt;td&gt;)。删除&lt;th&gt; 之一解决了问题。

    【讨论】:

      猜你喜欢
      • 2013-11-05
      • 1970-01-01
      • 1970-01-01
      • 2015-02-02
      • 2016-12-03
      • 1970-01-01
      • 1970-01-01
      • 2023-01-24
      • 2013-04-07
      相关资源
      最近更新 更多