vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
732 stars 284 forks source link

clear filter when using date_custom_func leaves last filtered date supplied to custom_func #644

Open louking opened 3 years ago

louking commented 3 years ago

test case: https://jsbin.com/cixawez/edit?html,js,output

steps to cause problem:

also ref: https://stackoverflow.com/questions/65460395/yadcf-clear-filter-when-using-date-custom-func-still-causes-last-date-to-be-supp

I have a table with start and finish dates in the rows, and I want to create a date filter which chooses rows for which the date in the filter is between the start and finish dates. The start or finish dates might be empty which means "unspecified" so the range is open on that side of the start/finish span.

I messed around with range date on the two columns but wasn't able to get that to work, and decided the best solution was probably to use the date_custom_func. This works for the most part, but seems like clearing the date in the filter causes the filterVal in the custom_func to be passed the last value of the filter rather than ''.