[英]Bootstrap-Table filterBy Not Working
我正在嘗試對我通過 JSON 填充的表進行一些過濾(使用wenzhixin 的引導表)。
部分 HTML:
<button class="btn btn-primary" id="filterBtn">Filter</button>
<div class="container">
<table class="table table-bordered table-hover" id="table">
<thead>
<tr>
<th data-field="make">Make</th>
<th data-field="model">Model</th>
<th data-field="year">Year</th>
</tr>
</thead>
</table>
</div>
部分JS:
// JSON file is input from a successful AJAX call.
function populateTable(json) {
$('#table').bootstrapTable({
data: json
})
}
// a button is click in html which calls this function.
function filterBy(model) {
console.log("filterBy is called");
$('#table').bootstrapTable('filterBy', {
make: [model]
});
}
該表正確填充了所有數據,但是一旦我點擊按鈕,我就會看到filterBy()
被調用,但所發生的一切只是看起來頁面刷新了,但表中的所有數據仍然存在,就像從未發生過過濾一樣。
我試過將make: [model]
更改為make: ["Honda"]
作為測試,但它仍然不起作用。 它仍然執行相同的行為,即在所有數據仍然完好無損的情況下刷新頁面。
不確定我做錯了什么。
https://github.com/wenzhixin/bootstrap-table/commit/de867d379a46b377efa7eef83fdf898b9073b28c
這是我在功能版本:1.11.0 之后認為的一個問題。 檢查 bootstrap-table.js 並找到它。 我希望它會解決你的問題。 祝你好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.