Reputation: 31
I try use bootstrap-table with Filter Control. After I change filter value and load data from ajax my filter value is cleared.
<table
id="table"
data-toggle="table"
data-url="https://examples.wenzhixin.net.cn/examples/bootstrap_table/data"
data-pagination="true"
data-method="post"
data-side-pagination="server"
data-filter-control="true"
data-search="true">
<thead>
<tr>
<th data-field="id" data-sortable="true" data-filter-control="input">ID</th>
<th data-field="name" data-sortable="true" data-filter-control="input">Item Name</th>
<th data-field="price" data-sortable="true" data-filter-control="select" data-filter-data="var:test">Item Price</th>
</tr>
</thead>
</table>
Example on: https://live.bootstrap-table.com/code/jarekherisz/10259
Edit: I found reason in the file: bootstrap-table-filter-control.js The module is defined to rebuild the controls after each load:
It thing to me that this is the wrong approach and the cause of the problem. After commenting this line, the value of the input field does not reset after loading the data.
Upvotes: 2
Views: 1435
Reputation: 469
Not a solve for this issue but I wanted to add that this is indeed a recognized issue with the interaction between the filter control plugin and server-side pagination, and that the recommended solution indeed seems to be to comment the createControls
line. The drawback is it's not practical to do this on the minified version.
Upvotes: 0