1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    14
    Vote Rating
    0
    emilyberk is on a distinguished road

      0  

    Default Answered: Formatting date in rowexpander xtemplate

    Answered: Formatting date in rowexpander xtemplate


    I Know there are several forum threads about this but none of the solutions work for me.

    In my xtemplate for my row expander I have a date field that I want to format
    Code:
    plugins: [{
            ptype: 'rowexpander',
            rowBodyTpl: this.something.getRowBodyXTemplate()
          }],
    the function getRowBodyXTemplate returns the xtemplate string which is like this

    Code:
    '<td > <p> discovered {discovered_at}</p> </td>'
    it's the discovered_at Date that i need to format.

    it's specified in the model as

    Code:
          
    { name: 'discovered_at', type: 'date'},
    and i tried this but my date came up undefined
    Code:
          
    { name: 'discovered_at', type: 'date', dateFormat: 'n-j-Y g:i A'},
    help?

  2. Try reverting your model to

    Code:
    { name: 'discovered_at', type: 'auto' },
    , and changing your template string to:

    Code:
    '<td><p> discovered {discovered_at:date("n-j-Y g:i A")}</p></td>'
    http://docs.sencha.com/ext-js/4-0/#/api/Ext.util.Format gives other examples of what you can do with format functions in templates.

    hope this helps,

    stevil

  3. #2
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    Answers
    15
    stevil will become famous soon enough

      0  

    Default


    Try reverting your model to

    Code:
    { name: 'discovered_at', type: 'auto' },
    , and changing your template string to:

    Code:
    '<td><p> discovered {discovered_at:date("n-j-Y g:i A")}</p></td>'
    http://docs.sencha.com/ext-js/4-0/#/api/Ext.util.Format gives other examples of what you can do with format functions in templates.

    hope this helps,

    stevil

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    14
    Vote Rating
    0
    emilyberk is on a distinguished road

      0  

    Default


    thanks so much. It works