bootstrap-table
bootstrap-table copied to clipboard
Custom filter is not called for null values
Bootstraptable version(s) affected
latest (online editor)
Description
I'm using a custom filter control function
I think a user (currently me) might need a filter to search for empty/null
values as well
Example(s)
<table
id="table"
data-filter-control="true"
data-show-search-clear-button="true">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="price" data-filter-control="select" data-filter-custom-search="final_cat_custom_filter">Item Price</th>
</tr>
</thead>
</table>
<script>
$(function() {
var data = [
{
"id": 1,
"price": 1
},
{
"id": 1,
"price": null
}
]
$('#table').bootstrapTable({'data': data})
})
function final_cat_custom_filter(...x) {
alert(JSON.stringify(x))
}
</script>
Possible Solutions
I think this commit introduced this bug: https://github.com/wenzhixin/bootstrap-table/pull/4494? Not sure
Additional Context
No response
Online example: https://live.bootstrap-table.com/code/wenzhixin/17502
Looks like the same code to me?
When you change the select filter, it only alerts one time when it should've done 2 times because there are two rows
Yes, I saved your code to the online editor.
Thank you! It wasn't formatted properly as well