Uncaught Error adding field - unknown field type select2

Uncaught Error adding field - unknown field type select2

system.bonn@gmail.comsystem.bonn@gmail.com Posts: 28Questions: 4Answers: 1
edited September 2019 in Free community support

Hi!

I have got a full license of datatables editor and planing to use it in a laravel app in conjunction with yajra's laravel-datatables.

I have downloaded editor.select2.js and guessed, it needs to be put into the editors 'js' folder, which I did.

I have both:

<link rel="stylesheet "href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/css/select2.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/js/select2.min.js"></script>

and changed my field to

                {
                  label: "Facility",
                  name:  "facility.name",
                  type:  "select2"
                }

but still "get Uncaught Error adding field - unknown field type select2"

Any ideas as to what I should check next?

thx & cu,
ada

Replies

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923
    edited September 2019

    Not sure how to do this in Laravel but did also include editor.select2.js with the rest of your JS includes like select2.min.js. editor.select2.js won't automatically be loaded.

    Kevin

  • system.bonn@gmail.comsystem.bonn@gmail.com Posts: 28Questions: 4Answers: 1
    edited September 2019

    Hi and thank you for your reply!

    Yes indeed, it needs to be explicitly loaded like so:

    <script src="{{ asset('plugins/editor/js/dataTables.editor.js') }}"></script>
    <script src="{{ asset('plugins/editor/js/editor.bootstrap4.min.js') }}"></script>
    
    <!-- Select2 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/js/select2.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.10/js/i18n/de.js"></script>
    <script src="{{ asset('plugins/editor/js/editor.select2.js') }}"></script>
    

    In this particular order.

    Thx & cu,
    ada

  • MrmikeMrmike Posts: 1Questions: 0Answers: 0

    Hi,

    I want to ask a question. That is where did you get the editor.select2.js?

    Thanks

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin

    It is available here to Editor licensees.

    Allan

This discussion has been closed.