upgrading DataTables from 1.10.16 to 1.10.19 breaks select2 plugin

upgrading DataTables from 1.10.16 to 1.10.19 breaks select2 plugin

dan@19ideas.comdan@19ideas.com Posts: 56Questions: 13Answers: 1

I upgraded the library to the latest, and when I ran the application, I get the following error:

Error adding field - unknown field type select2

Prior to this, everything worked as expected. When I downgraded back to the original version of 1.10.16, it started working again.

This question has an accepted answers - jump to answer

Answers

  • dan@19ideas.comdan@19ideas.com Posts: 56Questions: 13Answers: 1

    Hmmm, it could possibly be that the editor on the site is at version 1.7.4, but the npm version I'm using is only at 1.6.5. When I debugged the editor.select2.js plugin, it wasn't returning back correct results on this line:

    var _fieldTypes = DataTable.Editor ? DataTable.Editor.fieldTypes : DataTable.ext.editorFields;
    
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    Are you able to give me a link to a page showing the issue so I can take a look please?

    The Editor source isn't on npm, its just a distribution package that will copy files from your download on the Editor site to a suitable location in the npm packages. If you've downloaded and installed 1.7.4 the npm version shouldn't really matter.

    Using $.fn.dataTable.Editor.version on the browser's console will tell you what version you are using.

    Thanks,
    Allan

  • yajrayajra Posts: 21Questions: 1Answers: 1
    edited June 2018

    I am also trying out select2 today and encountered the same issue.

    $.fn.dataTable.Editor.version
    "1.7.4"
    

    -- Edit --
    I also tried the other plugins like ckeditor and selectize it shows the same error. Is there any additional js file that should be added aside from the library?

    Uncaught Error adding field - unknown field type selectize
    Uncaught Error adding field - unknown field type ckeditor
    
  • yajrayajra Posts: 21Questions: 1Answers: 1

    Ok I just found that required scripts.. My bad, testing again :)

  • yajrayajra Posts: 21Questions: 1Answers: 1
    Answer ✓

    After downloading the latest editor.select2.js, it's working as expected now.

This discussion has been closed.