django-autocomplete-light icon indicating copy to clipboard operation
django-autocomplete-light copied to clipboard

Can't open and setfocus on component on document.ready

Open andreccorrea opened this issue 4 years ago • 4 comments

I need to open and set the focus on my autocomplete on page load (document.ready). I used to do something like:

$(document).ready(function () {
    $('#select2_field').select2('open')
});

Due to Autocomplete-light initializing the component on document.ready too, it throws the error:

The select2('open') method was called on an element that is not using Select.

The question is: how can I open and focus the autocomplete on document.ready, after autocomplete-light full initialization?

andreccorrea avatar May 03 '21 11:05 andreccorrea

Excellent question, I believe we offer no way as of now. Do you want to open a PR that emits an event after initialization? Would that help?

jpic avatar May 11 '21 21:05 jpic

Hello, if you can guide me in the process, I would like to open the PR.

andreccorrea avatar May 12 '21 00:05 andreccorrea

Hi, I've added the event notifying after the initialization and created a pull request.

andreccorrea avatar May 13 '21 13:05 andreccorrea

Hi, I've opened the PR, how much time does it takes to be merged? There is anything more I can do?

andreccorrea avatar May 21 '21 11:05 andreccorrea