![](/img/trans.png)
[英]Initializing a Jquery DataTable with a local array of arrays as datasource
[英]jQuery Datatable Editor not initializing
我目前在页面中使用数据表。 但是,当我尝试添加datatable编辑器插件时,我在控制台中收到错误:
TypeError: $.fn.dataTable.Editor is not a constructor
我所做的只是在创建表的jquery中添加以下行:
var table = $('#sampledt').DataTable();
var editor = new $.fn.dataTable.Editor(table);
new $.fn.dataTable.Buttons( table, [
{
extend: "edit", editor: editor
},
{
extend: "remove", editor: editor
}
]);
table.buttons().container()
.appendTo( $('col-sm-6:eq(0)', table.table().container() ));
这些是页面中的.js和.css:
jquery-1.12.0.min.js
bootstrap.min.js
jquery.dataTables.min.js
dataTables.bootstrap.min.js
dataTables.buttons.min.js
buttons.bootstrap.min.js
dataTables.select.min.js
dataTables.editor.min.js
bootstrap.min.css
dataTables.bootstrap.min.css
buttons.bootstrap.min.css
select.bootstrap.min.css
editor.bootstrap.min.css
我错过了什么吗? 提前致谢。
更新:
我添加了var editor = new $ .fn.dataTable.Editor(table); 删除了未定义“编辑器”的控制台错误。 相反,发生了一个新错误:$ .fn.dataTable.Editor不是构造函数。
更新:
我从页面中删除了bootstrap.min.js。 控制台错误“TypeError:a.Editor is undefined”已被删除。
你使用免费试用版的文件? 确保您在试用期内购买了编辑器或获取更新的文件
我猜你错过了初始化。 您需要初始化变量editor
并为其赋值,如:
var editor = new $.fn.dataTable.Editor( {} );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.