yourlabs / django-autocomplete-light

A fresh approach to autocomplete implementations, specially for Django. Status: v4 alpha, v3 stable, v2 & v1 deprecated.
https://django-autocomplete-light.readthedocs.io
MIT License
1.79k stars 467 forks source link

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

Open andreccorrea opened 3 years ago

andreccorrea commented 3 years ago

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?

jpic commented 3 years ago

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?

andreccorrea commented 3 years ago

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

andreccorrea commented 3 years ago

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

andreccorrea commented 3 years ago

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