JQuery Datatable Editor does not initialize

I am currently using datatable on the page. However, when I try to add a datatable plug-in editor, I get errors in the console:

TypeError: $.fn.dataTable.Editor is not a constructor 

All I did was add the following lines in jquery to create the 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: .js and .css on 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 editor var = new $ .fn.dataTable.Editor (table); Failed to remove console editor error. Instead, a new error occurred: $ .fn.dataTable.Editor is not a constructor.

UPDATE:

I removed bootstrap.min.js from the page. The console error "TypeError: a.Editor is undefined" has been deleted.

+5
source share
2 answers

Are you using a file from the free evaluation version? make sure you purchase the editor or receive newer files during the trial period.

+3
source

I think you missed the initialization. You need to initialize the editor variable and assign it a value similar to:

 var editor = new $.fn.dataTable.Editor( {} ); 
0
source

Source: https://habr.com/ru/post/1245969/


All Articles