Open carlosfvieira opened 8 years ago
@f1nality this problem have some view with select2 logic, maybe?
@carlosfvieira, i think that it's a problem with the way that django jet builds the select inputs, it don't use normal select input, it use a fake select input.
bump
Please come to the django-jet Discord server so we can organize if you like:
Welcome! 😄
@jordotech Do you have this error?
Hi,
I also ran into this issue. Here is my code of template for a multi-select filter:
{% load i18n %}
<h3>{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}</h3>
<ul>
<li {% if spec.selected %}class="selected"{% endif %}>
<div class="submit-row CA-MultiselectDropdown">
<select multiple="multiple" style="width: 95%" class="CA-MultiselectDropdown__Select">
{% for choice in choices %}
<option value="{{ choice.query_string }}" {% if choice.selected %}selected="selected"{% endif %}>{{ choice.display }}</option>
{% endfor %}
</select>
<p class="help">{% trans 'Hold down "Control", or "Command" on a Mac, to select more than one.' %}</p>
<p class="submit-row">
<input style="width:47%" type="reset" value="{% trans "Clear" %}" data-reset-url="{{ spec.reset_url }}">
<input style="width:47%" type="submit" value="{% trans "Search" %}" data-field-name="{{ spec.lookup_kwarg }}">
</p>
</div>
</li>
</ul>
It works great without "django-jet". However, when used "django-jet" I get an empty select:
As I understand it, this is due to this code: https://github.com/geex-arts/django-jet/blob/dev/jet/static/jet/js/src/layout-updaters/toolbar.js#L31
This line also raises many questions. It turns out, I can not add my custom filter, even a simple input field... https://github.com/geex-arts/django-jet/blob/dev/jet/static/jet/js/src/layout-updaters/toolbar.js#L108
I see that there is a specific work around the multiple selects, for example here: https://github.com/geex-arts/django-jet/blob/dev/jet/static/jet/js/src/features/filters.js#L11 https://github.com/geex-arts/django-jet/blob/dev/jet/static/jet/js/src/layout-updaters/toolbar.js#L42
And yet, what is the correct way to add a multi-select filter to django-jet?
Versions: Python 3.6.5 (default, May 5 2018, 03:07:21) [GCC 6.3.0 20170516] on linux Django==2.0.8 django-jet==1.0.7
Thanks, Dmitry
@f1nality
Hi guys,
Any news? Is there a chance to fix this issue?
Thanks, Dmitry
Hi, i'm trying to use multiselect filter in modeladmin, but the rendered control is always the normal single selection dropdown. What do i need to change to get the control that i want? Also, django-jet already have this functionality built-in?
Thanks!
My multiselect list filters are based on this project: extraadminfilters... here's the code. filters.py: