Editor DataTable Shows error in browser's console when I use input field type select2
Editor DataTable Shows error in browser's console when I use input field type select2

I am using Editor Datatable,when I declare field of type select2 it shows error in console"Uncaught Error adding field - unknown field type select2", when I simply use type select dropdown works normally. Do I need to add specific select2.js file or does any select2 file comes with editor? Currently I am using https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js link.
I dont know where the issue is.
var editor;
$(document).ready(function () {
editor = new $.fn.dataTable.Editor({
"ajax": "/api/staff",
"table": "#example",
"fields": [{
"label": "PO No:",
"name": "PONo"
}, {
"label": "PO Line No:",
"name": "POLineNo",
"type": "select2",
"options":
[
{ label: "option1", value: "1" },
{ label: "option2", value: "2" },
{ label: "option3", value: "3" }
]
}]
});
});
Answers
DataTables has this cdn link:
//cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js
I notice your link is a beta - maybe that's the problem.
Tangerine thanks for your time, but unfortunately this link //cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js did not work.
Did you download the
editor.select2.js
plugin code from the plugin docs?https://editor.datatables.net/plug-ins/field-type/editor.select2
Kevin