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.8k stars 467 forks source link

Dropdown Menu is Covering Input Field. Position of Selection List is to High. #1024

Closed mogoh closed 6 years ago

mogoh commented 6 years ago

I am using dal and I am not sure if this problem is a bug or a misconfiguration. It is working fine in the admin interface but not in the users interface. When I am using an input field, the list to select is covering the input. Any help is appreciated. If this is not the right place to ask, please tell me.

Versions

Some code

class MessageForm(forms.Form):

    # Some probably non relevant code is cut out

    relation_queryset = PersonUnitRelType.objects.all()
    relation_recipients = forms.ModelMultipleChoiceField(
        label=_('Relation Recipients'),
        queryset=relation_queryset,
        required=False,
        widget=autocomplete.ModelSelect2Multiple(
            url='autocomplete-relation',
            attrs={'data-placeholder': _('Choose status groups …')}
        ),
    )
<form action="" method="post">
    {% csrf_token %}
    {{ form.non_field_errors }}
    <label for="{{ form.relation_recipients.id_for_label }}">{{ form.relation_recipients.label }}</label>
    <div class="fieldWrapper">
        {{ form.relation_recipients.errors }}
        {{ form.relation_recipients }}<br>
        <small>{% trans 'Choose status group to send message to. If a recipient group is selected above, only group members with this status will receive the message.' %}</small>
    </div>

Screenshots

Example field

screenshot_2018-07-18 ruhr-universitat bochum -

Selection is way to high

screenshot_2018-07-18 ruhr-universitat bochum - 1

mogoh commented 6 years ago

So I found the cause of the problem but not yet a solution. It is not really related to dal. I use django cms and the toolbar of the cms is moving the page down but not the input field. If I remove the toolbar, everything looks fine. I don't know what part of the toolbar moves the hole page.

mogoh commented 6 years ago

Can it be an issue, that dal and django-cms both use Select2 and that this creates a conflict?

mogoh commented 6 years ago

This issues is solved, if I set dal to use the jquery of the admin interface. I don't understand how this solves the problem, but it works for now.