With my bootstrap table I want to use the extension Filter Control
Server side I'm using django.
I include following css and js:
{% load bootstrap4 %}
{% bootstrap_css %}
{% bootstrap_javascript jquery='full' %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.1/bootstrap-table.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.1/extensions/filter-control/bootstrap-table-filter-control.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.1/bootstrap-table.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.1/extensions/filter-control/bootstrap-table-filter-control.min.js" ></script>
And here my html table:
<table
id="table"
data-toggle="table"
data-pagination="true"
data-pagination-h-align="left"
data-pagination-detail-h-align="right"
data-page-size="25"
data-page-list="[10, 25, 50, 100, all]"
data-search="true"
data-show-columns="true"
data-filter-control="true"
data-show-search-clear-button="true"
data-show-refresh="true"
data-url="../get_track_list">
<thead>
<tr>
<th data-field="datetime_start" data-formatter="DateFormatter" data-sortable="true" data-switchable="false" data-searchable="false">Date</th>
<th data-field="name" data-formatter="ActivityLinkFormatter" data-switchable="false">Name</th>
<th data-field="sport" data-formatter="SportSymbolFormatter" data-sortable="true" data-searchable="false" data-filter-control="select">Sport</th>
</tr>
</thead>
</table>
My data-url is a json file from a django request.
The resulting table looks like this:
I don't have any errors in the browser console. I also see the the filter-control div was created but not the dropdown field?
What I'm doing wrong, so that the data-filter-control="select"
field is not created?
The table is rendered without using any js functions, in my js file are just the custom data-formatter
I have tried run the input that you provided in https://live.bootstrap-table.com/
and the filter controls works only after removing the data-searchable="false"
(or setting it to true
).
So you should remove the data-searchable="false"
or set it to true