Uncaught TypeError: $.fn.dataTable.Editor is not a constructor
Uncaught TypeError: $.fn.dataTable.Editor is not a constructor
aldikhan
Posts: 3Questions: 1Answers: 0
Hi I am beginner programmer, I faced this error when I try to create datatable editor inline
$.fn.dataTable.Editor is not a constructor
What are the reason for that problem?
Here are my code :
var editor;
var editor = new $.fn.dataTable.Editor( {} );
new $.fn.dataTable.Editor( {
ajax: 'update-patient.php',
table: '#datatable-patient',
fields: [
{ label: 'Phone', name: 'phone' },
{ label: 'Name', name: 'name' },
{ label: 'Birthdate', name: 'birthdate' },
{ label: 'Joiningdate', name: 'joiningdate' },
{ label: 'Gender', name: 'gender' }
]
} );
$('#datatable-patient').on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.inline( this, {
buttons: { label: '>', fn: function () { this.submit(); } }
} );
} );
$('#datatable-patient').DataTable( {
dom: "Bfrtip",
ajax: 'ajax-get-patient.php',
columns: [
{ "data": "phone" },
{ "data": "name" },
{ "data": "birthdate" },
{ "data": "joiningdate" },
{ "data": "gender" },
],
select: true,
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: 'remove', editor: editor }
]
} );
Thanks
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
It suggests that the
dataTables.editor.js
file hasn't been included on your page. Have you got a link to the page so I can take a look and debug it?Allan
I have put this script
but still show error "$.fn.dataTable.Editor is not a constructor".
I'd really need a link to the page to understand what is going wrong I'm afraid. From your description it should be working okay, so I'm obviously missing some other information that I would need to be able to help resolve it.
Allan