StateSave with serverside restores wrong date value SearchBuilder and ColumnControl
StateSave with serverside restores wrong date value SearchBuilder and ColumnControl
in DataTables
Link to test case: https://intranet2.cimne.com/ws/demo_datatables
With ColumnControl and stateSave: true, a date entered as 06/10/1984 filters correctly. However, after reloading the page, the saved state restores it as 06-10-1984, and Editor PHP sends that value to MySQL, causing an Incorrect DATETIME value error.
SearchBuilder, when input 06/10/1984 doesnt work serverside.
SearchBuilder will also restore the state as 1984-10-06 00:00:00 and the search doesnt work.
I'm using the nigtly build as discussed here:
https://datatables.net/forums/discussion/81852/problem-with-date-type-on-3-0-update#latest
Replies
did a couple tests:
the working value sent when searching for 06/10/1984 is:
columns[2][columnControl][search][value] 1984-10-06T00:00:00.000Z
but after refreshing, state save reloads the value as:
columns[2][columnControl][search][value] 06-10-1984
the column is declared simply as:
and on the server side:
Many thanks for the test case. I'll take a look next week and get back to you.
Allan
Mi second issue, with SearchBuilder, seems to be related to: https://datatables.net/forums/discussion/81851
So my problem is only with column control and statesave at the moment.
In your example JS could you change:
To be:
please? That is how it is meant to work - I think there is a documentation error in the
searchDropdowndocs!With that change it seems to work okay for me, but if you could try it and let me know, that would be super.
Allan
Wow, yes, that did fix it! Somehow at some point I got in my head that the searchDropDown was supposed to work as a container.
Thanks Allan, sorry if this was a bit of a waste of time.
searchDropdown's docs are a bit misleading in that regard. I've committed this change which I hope will correct that, and included an example of how options can be used for it.Glad to hear that fixed the issue you were having
Allan