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

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

niveditanivedita Posts: 4Questions: 2Answers: 0

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

  • galcottgalcott Posts: 53Questions: 15Answers: 1

    See this page. I believe the first entry under "most common FAQs" will answer your question.
    https://datatables.net/faqs/index

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin
    edited June 2017

    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() or new $.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

  • niveditanivedita Posts: 4Questions: 2Answers: 0
    edited June 2017

    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.

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    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

  • niveditanivedita Posts: 4Questions: 2Answers: 0

    Nice .

This discussion has been closed.