Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select2 doesn't initialze in relation modal on first open #1544

Closed
b1rger opened this issue Jan 22, 2025 · 1 comment · Fixed by #1545 or #1546
Closed

Select2 doesn't initialze in relation modal on first open #1544

b1rger opened this issue Jan 22, 2025 · 1 comment · Fixed by #1545 or #1546
Assignees

Comments

@b1rger
Copy link
Contributor

b1rger commented Jan 22, 2025

... but it works when opening the modal a second time. This does not happen if another element on the page uses select2 (i.e. a foreignkey) and it also does not happen with the modals from apis-bibsonomy

@b1rger b1rger self-assigned this Jan 22, 2025
b1rger added a commit that referenced this issue Jan 22, 2025
The reinit_select2 functionality is now in a separate
`rel_reinit_select2` function which is run every time the js is included
*and* when the `reinit_select2` trigger is received (though not sure if
thats even needed now).
In addition the javascript is included in the relation forms Media
class, so that the js is included with every relation form and thus the
`rel_reinit_select2` function is executed everytime the form in loaded
which is what we actually want to make the select2 work everytime.

Closes: #1544
b1rger added a commit that referenced this issue Jan 23, 2025
The reinit_select2 functionality is now in a separate
`rel_reinit_select2` function which is run every time the js is included
*and* when the `reinit_select2` trigger is received (though not sure if
thats even needed now).
In addition the javascript is included in the relation forms Media
class, so that the js is included with every relation form and thus the
`rel_reinit_select2` function is executed everytime the form in loaded
which is what we actually want to make the select2 work everytime.

Closes: #1544
b1rger added a commit that referenced this issue Jan 23, 2025
The reinit_select2 functionality is now in a separate
`rel_reinit_select2` function which is run every time the js is included
*and* when the `reinit_select2` trigger is received (though not sure if
thats even needed now).
In addition the javascript is included in the relation forms Media
class, so that the js is included with every relation form and thus the
`rel_reinit_select2` function is executed everytime the form in loaded
which is what we actually want to make the select2 work everytime.

Closes: #1544
@gythaogg
Copy link
Contributor

Thanks so much - it was driving me mad, as I couldn't figure out a way to reproduce this issue reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants