I am currently using datatable in a page. However, when I try adding datatable editor plug-in, I am getting errors in the console:
TypeError: $.fn.dataTable.Editor is not a constructor
All I did was add the following lines in the jquery of creating a table:
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() ));
These are the .js and .css in the page:
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
Am I missing something? Thanks in advance.
UPDATE:
I added the var editor = new $.fn.dataTable.Editor(table); The console error of 'editor' not being defined was removed. Instead, a new error occurred: $.fn.dataTable.Editor is not a constructor.
UPDATE:
I removed the bootstrap.min.js from the page. The console error "TypeError: a.Editor is undefined" was removed.
editor
variable you assign to"edit"
defined somewhere? how? – Hardeditor()
lowercase? – Hardtable
you use to constructeditor
? – Hard