{% if togglable_colums %}
    <select class="selectpicker" multiple data-selected-text-format="count > 2" name="columns" id="column_selector">
    {% for key, value in togglable_colums.items %}
        {% if key == 'merge' and user.is_authenticated and enable_merge %}
        <option value="{{ key }}">{{ value }}</option>
        {% elif key == 'merge' and not user.is_authenticated %}
        {% elif key != 'merge' %}
        <option value="{{ key }}">{{ value }}</option>
        {% endif %}
    {% endfor %}
    </select>

    <script>
    $('#column_selector').on('loaded.bs.select', function (e) {
        var url = new URL(window.location.href);
        var columns = url.searchParams.getAll("columns");
        $('#column_selector').selectpicker('val', columns);
    });
    </script>

{% else %}

{% endif %}
