Files
fastapi-admin/fastapi_admin/templates/widgets/inputs/many_to_many.html
2021-05-06 21:42:39 +08:00

27 lines
857 B
HTML

{% with id = 'form-select-' + name %}
<div class="form-group mb-3">
<div class="form-label">{{ label }}</div>
<select multiple class="form-select" name="{{ name }}" id="{{ id }}">
</select>
{% if help_text %}
<small class="form-hint">
{{ help_text }}
</small>
{% endif %}
</div>
<script>
new Choices(el = document.getElementById('{{ id }}'), {
classNames: {
containerInner: el.className,
listDropdown: 'dropdown-menu',
itemChoice: 'dropdown-item',
activeState: 'show',
selectedState: 'active',
inputCloned: 'bg-white',
},
removeItemButton: true,
choices:{{ options|safe }}
});
</script>
{% endwith %}