Display date in dd/mm/yyyy but filter in original format yyyy-mm-dd
Display date in dd/mm/yyyy but filter in original format yyyy-mm-dd
Link to test case: http://live.datatables.net/mifujahi/1/edit
Debugger code (debug.datatables.net):
Error messages shown: No error message
Description of problem:
live.datatables.net example based on the following example : https://datatables.net/extensions/fixedheader/examples/options/columnFiltering
My question is probably easy but I was not able to find the solution.
I use Editor to query my database and I have a field in "timestamp" format
So I format my date like this in order to display it in easy readable format for human:
Field::inst( 'mydate' )
->set( false )
->getFormatter( Format::dateSqlToFormat('d/m/Y') ),
I created an example on "live.datatables.net" that seems to simulate what I need to do (but without the PHP for sure)
I would like to filter on the date 28/11/2008 for example.
But I don't want to write "2008-11-28" but "28/11/2008" in my filter field.
What is the correct way to filter on another format that the one selected?
Thanks in advance for your help and have a nice day.
Answers
With client side processing you can use orthogonal data to set the filter data format. Or simply change the format for all orthogonal operations, like this:
http://live.datatables.net/mifujahi/2/edit
Kevin
@kthorngren thanks for your answer.
You are right. In this case it works because all data are already loaded into the datatable.
But in my case, data are loaded from Editor component asynchronously.
So I cannot use orthogonal data and I don't konw how to tell to Editor component that it has to search with another format than the written one .
Just to clarify. The Editor is used only to edit the table. The Datatables component manages the table including searching. Do you have server side processing enabled (
serverSide: true
)?If you are then maybe this thread will help.
Kevin
Yes, I use:
I will have a look to this thread I tell you if it works for me.
It seems to be a little old and I hope it exists a simplier way to do search on date.
Thanks.