Initializing a DataTables 2 Editor
Initializing a DataTables 2 Editor
in Editor
I am upgrading legacy DataTables 1.10 instances and I am trying to create a stable 2.x setup before proceeding on to DataTables 3. In the process of upgrading Editor 1.8.1 to Editor 2.5.1 I am getting errors on both the legacy $.fn.dataTable and the newer documentation-specified format when initializing:
function userRemoveEditor(tableId) {
return new $.fn.dataTable.Editor({
ajax: {
remove: '/app/appUser/remove'
},
table: tableId
});
}
Uncaught TypeError: $.fn.dataTable.Editor is not a constructor
function userRemoveEditor(tableId) {
return new DataTable.Editor({
ajax: {
remove: '/app/appUser/remove'
},
table: tableId
});
}
Uncaught TypeError: DataTable.Editor is not a constructor
What is the correct syntax for initializing a DataTables 2 editor instance?
Environment:
jQuery 3.7.1
DataTables 2.3.8, Bootstrap 4
Editor 2.5.1
Replies
Hi,
It sounds like Editor might not have been loaded on the page. Another possibility is that DataTables has been loaded twice.
Are you able to PM me a link to the page so I can take a look and see what is going on? Or can you send me the HTML for the page perhaps - the might show a clue in the scripts being loaded.
Regards,
Allan