-
21 Dec 2011 12:29 PM #1
Answered: Date field not formatting in list
Answered: Date field not formatting in list
I am not able to get the date field to use the dateFormat from the model in a List
Code:
The list is using an itemTpl of '<div>{ExpectedStartDateTime}<p>{Description}</p></div>'Code:Ext.define('RDPMobile.model.WorkOrders', { extend: 'Ext.data.Model', fields: [ { name: 'Number', type: 'string' }, { name: 'Description', type: 'string' }, { name: 'Priority', type: 'string' }, { dateFormat: 'D m-d-Y G:I A', name: 'ExpectedStartDateTime', type: 'date' }, { name: 'Status', type: 'string' }, { name: 'Location', type: 'string' }, { name: 'SubLocation', type: 'string' }, { name: 'WorkFlow', type: 'string' }, { name: 'Note', type: 'string' } ] });
Thanks
Ron
-
Best Answer Posted by mitchellsimoens
Most likely you are seeing the date object turned to a string correct? Try this:
Of course you can change the format. The dateFormat config that you have in your Model is for translating the incoming string and parsing it into a JavaScript Date Object based off that format.Code:{ExpectedStartDateTime:date("Y-m-d")}
-
21 Dec 2011 2:14 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
- Answers
- 3105
Most likely you are seeing the date object turned to a string correct? Try this:
Of course you can change the format. The dateFormat config that you have in your Model is for translating the incoming string and parsing it into a JavaScript Date Object based off that format.Code:{ExpectedStartDateTime:date("Y-m-d")}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.
-
21 Dec 2011 3:30 PM #3


Reply With Quote