If we have filters on top of column on a table that is using the DT REST API wrapper, we cannot filter on date using formatted dates.
Created attachment 153180 [details] [review] Bug 34226: DT wrapper - pre-processed date term when filtering If we have filters on top of column on a table that is using the DT REST API wrapper, we cannot filter on date using formatted dates. This was done for "date of birth" for bug 32505. Here we want to provide a generic approach. Note that we cannot use what has been done on bug 22440 in some cases (when we don't write the thead DOM directly but rely on DataTables constructor, for instance bug 33568). The data- attributes are not passed by DT. Test plan: On top of 33568, filter date columns using the full version of the formatted date
Created attachment 153830 [details] [review] Bug 34226: DT wrapper - pre-processed date term when filtering If we have filters on top of column on a table that is using the DT REST API wrapper, we cannot filter on date using formatted dates. This was done for "date of birth" for bug 32505. Here we want to provide a generic approach. Note that we cannot use what has been done on bug 22440 in some cases (when we don't write the thead DOM directly but rely on DataTables constructor, for instance bug 33568). The data- attributes are not passed by DT. Test plan: On top of 33568, filter date columns using the full version of the formatted date Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 153831 [details] [review] Bug 34226: WIP Using 'type' at the datatable config level What about using 'type' definitions at the datatables settings level and binding that to a flatpickr instance?
I struggled a bit to put this in context with bug 33568 so I was testing it using the patrons search table (yes, I know.. it's already one of the more complex ones) I've added a patch on top that takes us towards a more generic way of displaying the standard flatpickr in the search headers.. does this go towards achieving what you hope or am I completely misunderstanding the work here?
Thanks Martin, that's definitely the way to go. I thought I tried it and it didn't work, but apparently I was wrong. There is only thing however that would not work directly: the apply_flatpickr. It is in calendar.inc and you have to include it from the tt you are including datatables.js I've tried with 33568 and it does not work (at least easily) because of the way includes and js files are embedded. I would move the flatpickr thing to another bug report.
There is another thing with flatpickr: you cannot longer search for a year. If you want to search all patrons born in 1958, flatpickr will blank the input if no date has been selected.
Created attachment 153835 [details] [review] Bug 34226: Remove apply_flatpickr It needs more work. The include calendar.inc should not be done in patron-search.inc, and the order of the include (inc+js) is wrong at some point (need more investigation) Also you cannot search for a specific year, you need to enter a valid date
I've updated and adjusted the remote branch of bug 33568 with your suggestion and it is working great.
Excellent, thanks for the feedback Jonathan, I'm glad I could help here. Yes, more than happy to migrate the flatpickr piece into it's own bug, that's certainly where the WIP was headed.. I agree, the order of inserting the JS is a bit funky and I'd like to somehow improve that but got a bit stuck there in the quick look I had. As for year only, I also spotted that and wasn't yet sure how to overcome it. I'll open another bug for the flatpickr side.. it's a lovely addition if we can get it working for the cases we need.
Oh.. isn't this also an almost duplicate of bug 32559 ?
*** Bug 32559 has been marked as a duplicate of this bug. ***
Yes, definitely a duplicate!
Will be submitting the squash of both bugs first thing in the morning.
Created attachment 153862 [details] [review] Bug 34226: DT wrapper - pre-processed date term when filtering If we have filters on top of column on a table that is using the DT REST API wrapper, we cannot filter on date using formatted dates. This was done for "date of birth" for bug 32505. Here we want to provide a generic approach. Note that we cannot use what has been done on bug 22440 in some cases (when we don't write the thead DOM directly but rely on DataTables constructor, for instance bug 33568). The data- attributes are not passed by DT. Test plan: On top of 33568, filter date columns using the full version of the formatted date Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 153863 [details] [review] Bug 34226: Use 'type' at the datatable config level Lets use 'type' definitions at the datatables settings level instead Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 153864 [details] [review] Bug 34226: Add tests Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bugs merged, tests stolen, WIP commit and follow-up squashed and all submitted here.. signoffs migrated and QA scripts all run for good measure again. All is working well from my perspective, Passing QA
Applied these patches on the remote branch of bug 33568 and all seems to work perfectly. Thanks, Martin!
Pushed to master for 23.11. Nice work everyone, thanks!
Enhancement not backported to 23.05.x