dropdown with input

dropdown with input

reminatorreminator Posts: 8Questions: 2Answers: 0

Hello,
i have editor datatables with dropdown list. Unfortunately, the list is far too long and it always takes a while to find the right entry. For this reason I want a dropdown with an input field where after typing letters the list gets smaller and you can then select an entry from the list. But you can't write something yourself, you can always take it from the list.

.....fields: [ { label: "Person", name: "Person", type: "select", options: dropdownPerson.value }.......
thanks

Answers

  • scholarlylabsscholarlylabs Posts: 16Questions: 0Answers: 2

    Have a look at the Select2 input.

  • reminatorreminator Posts: 8Questions: 2Answers: 0

    can you maybe adapt it to my code? what does it look like then? type=select2 doesn't work

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited August 2022

    I see you're using Editor in your example, but our accounts aren't showing that you have a license. Is the license registered to another email address? Please can let us know so we can update our records and provide support.

    Thanks,

    Colin

  • reminatorreminator Posts: 8Questions: 2Answers: 0

    hi @colin , this is my private account I have the licenses in my work account

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    OK, could you PM me the account that holds those details, please.

    Colin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    This example in this thread should help, as it's demonstrating just that. The 'Office' field has a Select2 control that allows filtering on the options. The code pasted at the front is the
    Select2 plugin,

    Colin

  • reminatorreminator Posts: 8Questions: 2Answers: 0
    edited August 2022

    is this the correct way to add the plug in code to the html?
    <script type="text/javascript" src="~/lib/DataTables/Select2-4.0.2/js/plugin.js"></script>
    in plugin.js is all the code from the downloaded plugin

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin

    Looks good to me. If you have Select2 loaded in as well.

    Allan

  • reminatorreminator Posts: 8Questions: 2Answers: 0
    edited August 2022

    hi Allan,
    yes I did, but I get this error:

    editor.select2.js:112 Uncaught TypeError: Cannot read properties of undefined (reading 'ext')
    at editor.select2.js:112:20
    at editor.select2.js:106:9
    at editor.select2.js:108:2

  • reminatorreminator Posts: 8Questions: 2Answers: 0

    I fixed the error above, it was due to the order of the scripts, but unfortunately it still doesn't work. For "Person" I have no input field, no dropdown... nothing at all

  • reminatorreminator Posts: 8Questions: 2Answers: 0

    div class = select2-hidden-accessible fluid selection ui dropdown

    it always automatically makes the field hidden. I see that in developer mode, as soon as I remove hidden the dropdown is visible...

  • allanallan Posts: 63,696Questions: 1Answers: 10,500 Site admin

    I'd really need a link to your page. You can PM it to me if you don't want to make it public.

    Allan

Sign In or Register to comment.