Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom filter is not called for null values #7266

Open
ebq-m opened this issue Apr 4, 2024 · 5 comments
Open

Custom filter is not called for null values #7266

ebq-m opened this issue Apr 4, 2024 · 5 comments
Labels
Bug Issues which are marked as Bug filter-control Issues for the filter-control extension.

Comments

@ebq-m
Copy link

ebq-m commented Apr 4, 2024

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: #4494?
Not sure

Additional Context

No response

@ebq-m ebq-m added the Bug Issues which are marked as Bug label Apr 4, 2024
@wenzhixin wenzhixin added the filter-control Issues for the filter-control extension. label Apr 24, 2024
@wenzhixin
Copy link
Owner

@ebq-m
Copy link
Author

ebq-m commented Apr 24, 2024

Looks like the same code to me?

@ebq-m
Copy link
Author

ebq-m commented Apr 24, 2024

When you change the select filter, it only alerts one time when it should've done 2 times because there are two rows

@wenzhixin
Copy link
Owner

wenzhixin commented Apr 24, 2024

Yes, I saved your code to the online editor.

@ebq-m
Copy link
Author

ebq-m commented Apr 24, 2024

Thank you! It wasn't formatted properly as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are marked as Bug filter-control Issues for the filter-control extension.
Projects
None yet
Development

No branches or pull requests

2 participants