Search code examples
dateformatsencha-touch-2textfield

Date format in a textfield


I have a textfield:

xtype: "fieldset",
items:[
   {
    xtype: "textfield",
    name: "dateScanned",
    label: "Datum",
    disabled: true,
    tpl: "{dateScanned:date('d/m/Y H:i')}"  // <--- this dosn't work
   }
]

My Store is:

fields: [
    { name: 'dateScanned', type: 'date', dateFormat: 'c' }
]

Why does the marked point not work? How can I realize that the date is fomatted?


Solution

  • I have a solution:

    dateFormat instead of tpl

    xtype: "fieldset",
    items:[
       {
        xtype: "datepickerfield",
        name: "dateScanned",
        label: "Datum",
        disabled: true,
        dateFormat: "d.m.Y H:i"
        //tpl: "{dateScanned:date('d/m/Y H:i')}"  // <--- this dosn't work
       }
    ]
    

    I don't know, but I believe to remember that it is important to set the double question marks.