DataTable makeEditable不起作用(不是函数),我的JS脚本是否兼容?

时间:2015-08-28 15:46:02

标签: javascript jquery thymeleaf

我有一个很大的问题列表,试图让我的数据表可编辑,所以我想检查我的脚本是否兼容。

    <div th:replace="fragments/partial :: partialJs"></div>
<div th:replace="fragments/withEasy :: js"></div>


<script type="text/javascript"
    src="../../resources/js/jquery-1.11.3.min.js"
    th:src="@{/resources/js/jquery-1.11.3.min.js}"></script> 

    <script type="text/javascript" src="https://cdn.datatables.net/r/dt/jqc-1.11.3,dt-1.10.8/datatables.min.js" ></script>

<script type="text/javascript"
    src="../../resources/js/plugins/dataTables/jquery.dataTables.editable.js"
    th:src="@{/resources/js/plugins/dataTables/jquery.dataTables.editable.js}"></script> // ver 2.3.3.

<script type="text/javascript"
    src="../../resources/js/plugins/dataTables/jquery.dataTables.js"
    th:src="@{/resources/js/plugins/dataTables/jquery.dataTables.js}"></script> //ver 1.10.0

        <script type="text/javascript"
    src="../../resources/js/jquery.jeditable.js"
    th:src="@{/resources/js/jquery.jeditable.js}"></script>
    // Version 1.7.3


    <script type="text/javascript"
    src="../../resources/js/jquery.validate.min.js"
    th:src="@{/resources/js/jquery.validate.min.js}"></script> //v1.13.1

1 个答案:

答案 0 :(得分:0)

你正在加载jQuery两次,第二次来自cdn.datatables.net。使用没有嵌入jQuery的链接,即https://cdn.datatables.net/r/dt/dt-1.10.8/datatables.min.js

此外,您正在加载DataTables脚本两次,首先来自cdn.datatables.net,然后是本地../../resources/js/plugins/dataTables/jquery.dataTables.js。删除../../resources/js/plugins/dataTables/jquery.dataTables.js

Aslo jquery.jeditable.js需要在jquery.dataTables.editable.js之前加载。