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

Atif NadeemAtif Nadeem Posts: 5Questions: 3Answers: 0

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

This discussion has been closed.