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

How to use filter-control to search records between two dates #7301

Closed
merinosky opened this issue Apr 26, 2024 · 2 comments
Closed

How to use filter-control to search records between two dates #7301

merinosky opened this issue Apr 26, 2024 · 2 comments
Labels
help-wanted Issues we need or would love help from the community to resolve.

Comments

@merinosky
Copy link

Description

Let's say my table has a "Date" column and I want to filter records between two given dates. Besides the filter date inputs must be outside the table. I have tried to achieve this by creating two filters like these:

<div id="filterDateFrom">
    <input type="date" id="inputFilterDateFrom" class="bootstrap-table-filter-control-dateFrom"></input>
</div>
<div id="filterDateTo">
    <input type="date" id="inputFilterDateTo" class="bootstrap-table-filter-control-dateTo"></input>
</div>

and defining the table like this:

<table id="tableWithDates" class="table"
			data-toggle="table"
			data-side-pagination="server"
			data-filter-control="true"
			data-filter-control-container="#filterDateFrom"
			data-filter-control-container="#filterDateTo">

And the date columns like this:

<th data-field="dateFrom" data-searchable="false" data-filter-control="datepicker"></th>
<th data-field="dateTo" data-searchable="false" data-filter-control="datepicker"></th>

Inputs are displayed properly, but nothing happens when I change date inputs.

1- Do I need to trigger manually the filter event? If so, why? Select filters are triggered when they change.
2- As you see I have included two data-filter-control-container options, but I don't know if that is even accepted.
3- Is there a better way to filter records between two dates? Perhaps I am missing something obvious.

Example(s)

No response

@merinosky merinosky added the help-wanted Issues we need or would love help from the community to resolve. label Apr 26, 2024
@merinosky
Copy link
Author

Already figured it out. You can close it!

@wenzhixin
Copy link
Owner

OK, thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted Issues we need or would love help from the community to resolve.
Projects
None yet
Development

No branches or pull requests

2 participants