1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
    ron_stahl is on a distinguished road

      0  

    Default 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:
    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'
            }
        ]
    });
    The list is using an itemTpl of '<div>{ExpectedStartDateTime}<p>{Description}</p></div>'

    Thanks
    Ron

  2. Most likely you are seeing the date object turned to a string correct? Try this:

    Code:
    {ExpectedStartDateTime:date("Y-m-d")}
    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.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,649
    Vote Rating
    898
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    Most likely you are seeing the date object turned to a string correct? Try this:

    Code:
    {ExpectedStartDateTime:date("Y-m-d")}
    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.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
    ron_stahl is on a distinguished road

      0  

    Default


    That was it.

    Thanks!

Thread Participants: 1