Closed molerat619 closed 6 years ago
A date range picker is by definition used to selected a date between two dates, i.e the date must be later than or equals to the start date AND earlier than or equal to the end date. If you have your own logic you can implement your own filter (see the docs on custom filters)
Now I have another scenario where this feature would be helpful and it has nothing to do with dates.
I want to filter by car, bus, both or none. Therefore I have created my own filter and it works for all cases except "filter by both".
What's the best way to put an or-query here?
define a vehicles
array on your instance. Keep it up-to-date with the user's selection, and pass the array to the event as the query. Then check if the vehicle in contained in the passed array (query.includes(row.vehicle)
)
I got that far but now the question is how I can use it in the backend. I am using the EloquentClass but I don't see how that can handle "or"s. I know this module does not really support the EloquentClass, but I think it will be useful for others too who come across this need.
I thought you were asking about the client table. The Eloquent class is merely a barebones starter template. You can modify it to your needs, and if you think your changes will benefit others, you are welcome to send a PR. Anyway, it should be quite easy to implment. Instead of LIKE
use WHERE IN
and you are all set.
Alright, I'll see what I can do then. Thank you @matfish2
I have following code, but it is missing the fact, that either the start_date or the end_date has to be in the given time period.
Do I have to write a custom filter for that or is there something in place already?