数据表 makeEditable() 不是函数?

Datatable makeEditable() is Not a function?

angular.js:11594 TypeError: undefined is not a function
at ini_table (http://localhost/ferpa-quiz-client/assets/js/controller.js:127:15)
at HTMLDocument.<anonymous> (http://localhost/ferpa-quiz-client/assets/js/controller.js:26:5)
at j (http://localhost/ferpa-quiz-client/bower_components/jquery/dist/jquery.min.js:2:26911)
at Object.k.add [as done] (http://localhost/ferpa-quiz-client/bower_components/jquery/dist/jquery.min.js:2:27220)
at n.fn.ready (http://localhost/ferpa-quiz-client/bower_components/jquery/dist/jquery.min.js:2:29326)
at new <anonymous> (http://localhost/ferpa-quiz-client/assets/js/controller.js:21:16)
at e (http://localhost/ferpa-quiz-client/bower_components/angular/angular.min.js:37:96)
at Object.instantiate (http://localhost/ferpa-quiz-client/bower_components/angular/angular.min.js:37:207)
at http://localhost/ferpa-quiz-client/bower_components/angular/angular.min.js:76:267
at link (http://localhost/ferpa-quiz-client/bower_components/angular-route/angular-route.min.js:7:248) <div ng-view="" class="ng-scope">

这是我遇到的错误,错误是我的代码。删除 .makeEditable() 后一切正常。

$("#questiontable").DataTable(
            {
                bAutoWidth: true,
                bProcessing: true,
                ajax: '../api/ferpa-quiz/public/getallquestion',
                sDom: '<"$grid-toolbar"sF>tr<"dataTables-footer"ilp>',
                iDisplayLength: 5,

                aoColumns: [
                    { 
                        mData: 'QUESTION',
                        sTitle: "QUESTION"

                    }


                ]

            }
        ).makeEditable();

HTML

<script src="bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<link href="bower_components/datatables/media/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="bower_components/ediTable/jquery.dataTables.editable.js"></script>
<script src="bower_components/jeditable/js/jquery.jeditable.js"></script>

我尝试过的事情: 1. 将 'D' 切换为 'd'。两者都不起作用 2.改变脚本引用的顺序。不起作用。

JQuery 1.10.2 Datatable makeEditable() is Not a function

脚本顺序:

根据您的示例,可能是脚本加载顺序不正确。 dataTables 网站上给出的示例按以下顺序加载脚本:

jquery.min.js
jquery.dataTables.min.js
jquery.jeditable.js
jquery-ui.js
jquery.validate.js //not sure this one is strictly needed
jquery.dataTables.editable.js

jeditabledataTables.editable 调用的必需脚本。这也意味着 jeditable 需要在 之前 dataTables.editable.

加载

JQuery 在 Angular JS:

我对 angular js 不是很熟悉,但是从他们的文档来看...

Does Angular use the jQuery library?

Yes, Angular can use jQuery if it's present in your app when the application is being bootstrapped. If jQuery is not present in your script path, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.

而且,JQLite 与 JQuery 不同...您需要 JQuery 才能 dataTable。注:

Angular 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with Angular but we don't guarantee that.

因此,版本也很重要。