-
13 Nov 2011 2:01 AM #1
Unanswered: XTemplate retriving a date from local storage in Safari doesn't work
Unanswered: XTemplate retriving a date from local storage in Safari doesn't work
But it does work in Chrome ST2.0 PR2 strangely enough.
Ext.create('Ext.XTemplate', {startDateTime}) where startDateTime is of type date from a model,
when rendered in a list shows a date in Chrome but when I open Safari on desktop or on iOS5 I get 'null' showing. It's strange because when inspecting localStorage I can see the date field ok.
-
13 Nov 2011 6:32 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
Are you defining your XTemplate exactly like:
If so that is not valid, {startDateTime} is an invalid Object. Try something like this:Code:Ext.create('Ext.XTemplate', {startDateTime})
Code:var tpl = Ext.create('Ext.XTemplate', '{startDateTime}', '<br>{title}' ); var html = tpl.apply({ startDateTime : new Date(), title : 'Hi' }); Ext.getBody().update(html);Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Nov 2011 1:47 PM #3
I didn't realize that thanks, I missed the quotes in the post sorry. I dug further and found that its nothing to do with the template. I tried just accessing the date from the record directly and it returns null in safari from local storage second time around but the store thinks its ok first time around ie it's shows immediately after a save and load (sync alone doesn't work as per other threads with localstore).
However on page refresh the retrieved date comes out null. I fixed this by retyping the field to an int and using seconds from epoch. It's really odd.


Reply With Quote