Skip to content

Instantly share code, notes, and snippets.

View ionwebs's full-sized avatar

IonWebs ionwebs

View GitHub Profile
@ionwebs
ionwebs / Select2-Field-Type-for-Datatables-Editor.js
Created May 9, 2021 07:10
Select2 Field Type for Datatables Editor
(function ($, DataTable) {
if (!DataTable.ext.editorFields) {
DataTable.ext.editorFields = {};
}
var _fieldTypes = DataTable.Editor?DataTable.Editor.fieldTypes:DataTable.ext.editorFields;
_fieldTypes.select2 = {
_addOptions: function (conf, options) {
var elOpts = conf._input[0].options;
elOpts.length = 0;
if (options) {
@ionwebs
ionwebs / Select2-Field-Type-for-Datatables-Editor-Example.js
Created May 9, 2021 07:18
Select2 Field Type for Datatables Editor Example
editor = new $.fn.dataTable.Editor({
ajax: {
url: "URL",
type: "POST"
},
table: "#tableid",
fields:
[
{
"label": "Field Label",