Uncaught TypeError: $.fn.dataTable.Editor is not a constructor
Uncaught TypeError: $.fn.dataTable.Editor is not a constructor
I am getting above error while using editor. Please help me fix this issue.
editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "/restservice",
"domTable": "#example",
"fields": [ {
label: "id:",
name: "id"
}, {
label: "firstName:",
name: "firstName"
}, {
label: "lastName:",
name: "lastName"
}, {
label: "email:",
name: "email"
}
]
} );
I am using below of js files.
jquery-1.12.1.min.js
jquery.dataTables.js
dataTables.select.min.js
dataTables.editor.min.js
dataTables.buttons.min.js
Answers
See this page. I believe the first entry under "most common FAQs" will answer your question.
https://datatables.net/faqs/index
You are right in the majority of cases involving similar API errors, that is the issue. However, in this case this isn't a DataTables API instance we were working with (i.e. it is not the result of
$(...).DataTable()
ornew $.fn.dataTable.Api()
).The
$.fn.dataTable.Editor
and$.fn.DataTable.Editor
constructors are identical (its the same one assigned to both). So in this case, that isn't the problem.My guess is that jQuery might be getting loaded twice on the page? Or perhaps there is some other error being shown in the console?
Allan
Thanks Allan for your input. Now i am getting below error .
dataTables.editor.min.js:13 Uncaught DataTables Editor - remote hosting of code not allowed. Please see http://editor.datatables.net for details on how to purchase an Editor license.
Please advise.
It sounds like you are either loading the code directly from the Editor site, or you have just downloaded the Editor demo code that is used on the site.
You'll need to download Editor from its download page to be able to use it.
Regards,
Allan
Nice .