jQWidgets Forums
jQuery UI Widgets › Forums › Grid › restoreingState of grid has a date format problem
This topic contains 11 replies, has 6 voices, and was last updated by ivanpeevski 3 years, 3 months ago.
-
Author
-
Hi,
SaveState saves date filtervalues in format given in cellsformat oft the column ( in this case /
cellsformat: 'dd.MM.yyyy'
)
Loading this state again results in switching the month and the days (ddMMyyyy format vs MMddyyyy format).
So if i save a date range like05.05.2017 – 06.05.2017
the restored date lookslike 05.05.2017 – 05.06.2017
Please check the linked fiddle where the issue can be reproduced
FIDDLE
http://jsfiddle.net/6wgbgc08/6/*Enter a date range in the date filter (e.g. 05.05.2017 – 06.05.2017)
*Klick on ‚Save State‘
*Klick on ‚Restore State‘
* See the problemHello ChriD,
Thank you for the interest.
I tested the example below and it seems to work fine.<!DOCTYPE html> <html lang="en"> <head> <title id='Description'>This example shows how to Save/Load the Grid's state.</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.storage.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdatetimeinput.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcalendar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsresize.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsreorder.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript" src="../sampledata/generatedata.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { var data = generatedata(100); var source = { localdata: data, datatype: "array", datafields: [ { name: 'firstname', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'available', type: 'bool' }, { name: 'date', type: 'date' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' } ] }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 850, source: dataAdapter, altrows: true, sortable: true, filterable: true, showfilterrow: true, selectionmode: 'multiplecellsextended', columns: [ { text: 'First Name', datafield: 'firstname', width: 130 }, { text: 'Ship Date', datafield: 'date', filtertype: 'range', cellsformat: 'd' }, { text: 'Quantity', datafield: 'quantity', width: 70, align: 'right', cellsalign: 'right', filtertype: 'number' }, { text: 'Price', datafield: 'price', cellsalign: 'right', align: 'right', cellsformat: 'c2' } ] }); $("#saveState").jqxButton({ theme: theme }); $("#loadState").jqxButton({ theme: theme }); var state = null; $("#saveState").click(function () { // save the current state of jqxGrid. state = $("#jqxgrid").jqxGrid('savestate'); }) ; $("#loadState").click(function () { // load the Grid's state. if (state) { $("#jqxgrid").jqxGrid('loadstate', state); } else { $("#jqxgrid").jqxGrid('loadstate'); } }); }); </script> </head> <body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="jqxgrid"> </div> <div style="margin-top: 30px;"> <input type="button" id="saveState" value="Save State" /> <input type="button" id="loadState" value="Load State" /> </div> </div> </body> </html>
(but we will investigate your scenario)
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi, Any update on this topic?
No, because we cannot reproduce it as it was mentioned by my colleague.
Hi,
That’s not correct? Your colleague wrote that he will investigate my scenario (last sentence in his post)
I had attached a fiddle in my first post and some info how you can reproduce the issue easily.
The sample of your colleague works because he uses ‘d’ for the cellsformat instead of ‘dd.MM.yyyy’ as i use in the fiddle.
I do not want to use ‘d’ because ‘d’ is MM\dd\yyy (MDY) and this format is only valid in the USA, Canada, Saudi Arabia and a few more. All others use dd.MM.yyyy (DMY) or (YMD)So you are not able to reproduce this issue with the fiddle i provided?
That is interesting and this would lead to the consideration if the client machine date settings are involved?Hello ChriD,
I tested this example below and it seems to work fine:
https://www.jseditor.io/?key=grid-state
Also, we recommend using the latest version of jQWidgets: http://www.jqwidgets.com/download/Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comWell…
Again you use ‘d’ as cellformat and not ‘dd.MM.yyyy’
I mentioned this in the post before!Change the cellformat in the date column in your ‘working’ example from ‘d’ to ‘dd.MM.yyyy’ and then you can reproduce the problem.
With ‘d’ it works, but i do not want to use the “USA date format”.Thanks
Hello ChriD,
I created a work item for this case.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comIs this problem solved?
Hello existenz,
It is not resolved but the work item for this case is still valid.
You could visit and check on the Release History page.
With every one new version, you could find there all new things and fixes.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comDespite the changelog for version 8.3.2 says that this bug is resolved, it is not.
I try your script athttps://www.jseditor.io/?key=grid-state
Changing the format from d to dd/MM/yyyy, running the script, and after saved a range, the load state shows “NaN/NaN/0NaN – NaN/NaN/0NaN”.
Can you try it again?
Hello dadiduekappa,
Thank you for reporting the problem, I have created a work item regarding this and we will work on fixing it as soon as possible.
If you have face any other problems, please do not hesitate to contact us again
Best regards,
Ivan Peevski
jQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.