KasperOlesen / DataTable-AltEditor

Updated version of the free-datatables-editor-alternative from Kingcode.com
MIT License
329 stars 195 forks source link

Issue with select2 (modal not working, editing not working) #217

Closed ludekvodicka closed 1 year ago

ludekvodicka commented 2 years ago

It seems there is an issue in select2 initialization

Based on this post: https://stackoverflow.com/a/46549199/113842

it's necessary to add following line to createDialog select2 initialization:

columnDefs[j].select2.dropdownParent = $("#altEditor-modal-" + this.random_id);

a whole code should look like this:

  // enable select 2 items, datepicker, datetimepickerm
          for (var j in columnDefs)
          {
            if (columnDefs[j].select2)
            {
              columnDefs[j].select2.dropdownParent = $("#altEditor-modal-" + this.random_id);
              $(selector).find("select#" + columnDefs[j].name).select2(columnDefs[j].select2);
            }

after that, select2 will work as expected