-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Issue with Autocomplete Fields in StackedPolymorphicInline.Child Inline #546
Comments
This is happening for me as well:
|
I'm also seeing this with |
For the time being I think I've managed to work around this by adding the following JS to the relevant (function($) {
$(document).ready(function() {
/* Listen for legacy jQuery events triggered by `django-polymorphic`
and trigger corresponding native event
issue: https://github.com/django-polymorphic/django-polymorphic/issues/546
*/
$(document).on('formset:added', function(event, row, prefix) {
if (!row) return;
row.get(0).dispatchEvent(new CustomEvent('formset:added', {
bubbles: true,
detail: {
formsetName: prefix,
},
}));
});
});
})(django.jQuery || jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I'm encountering an issue related to autocomplete fields within an inline with the class StackedPolymorphicInline.Child.
Summary:
The problem is that the dropdown menus for autocomplete fields appear empty, and no AJAX calls are made.
Description/details:
After analyzing the code, it seems that there might be an incompatibility between the event triggering mechanisms used in the polymorphic_inlines.js file and the callback defined in the Django package's autocomplete.js file.
In polymorphic_inlines.js, the event is triggered using jQuery as follows:
On the other hand, the event is supposed to be received by the callback defined in the Django package's autocomplete.js file, where we find the following code:
It appears that the autocomplete functionality does not receive this event due to the discrepancy in the triggering mechanism.
In the Django package's inlines.js file, in fact, the same event is triggered using plain JavaScript in the following manner:
Versions:
I am using the following versions:
Could you please investigate this issue and provide guidance on how to resolve it? Is there a recommended workaround or fix available?
Thank you for your attention to this matter.
Best regards,
Guido Longoni
The text was updated successfully, but these errors were encountered: