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

Revert select2 width to auto #243

Merged
merged 1 commit into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jazzmin/static/jazzmin/js/change_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
// Apply select2 to any select boxes that don't yet have it
// and are not part of the django's empty-form inline
const noSelect2 = '.empty-form select, .select2-hidden-accessible, .selectfilter, .selector-available select, .selector-chosen select';
$('select').not(noSelect2).select2({ width: 'element' });
$('select').not(noSelect2).select2({ width: 'auto' });
}

$(document).ready(function () {
Expand Down
4 changes: 2 additions & 2 deletions jazzmin/static/jazzmin/js/change_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
// Make search filters select2 and ensure they work for filtering
const $ele = $('.search-filter');
$ele.search_filters();
$ele.select2({ width: 'element' });
$ele.select2({ width: 'auto' });

// Use select2 for mptt dropdowns
const $mptt = $('.search-filter-mptt');
if ($mptt.length) {
$mptt.search_filters();
$mptt.select2({
width: '100%',
width: 'auto',
templateResult: function (data) {
// https://stackoverflow.com/questions/30820215/selectable-optgroups-in-select2#30948247
// rewrite templateresult for build tree hierarchy
Expand Down
2 changes: 1 addition & 1 deletion jazzmin/templates/jazzmin/widgets/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
{% include option.template_name with widget=option %}{% endfor %}{% if group_name %}
</optgroup>{% endif %}{% endfor %}
</select>
<script>django.jQuery('#id_{{ widget.name }}').select2({ width: '100%' })</script>
<script>django.jQuery('#id_{{ widget.name }}').select2({ width: 'auto' })</script>