我有一个文本字段:
xtype: "fieldset",
items:[
{
xtype: "textfield",
name: "dateScanned",
label: "Datum",
disabled: true,
tpl: "{dateScanned:date('d/m/Y H:i')}" // <--- this dosn't work
}
]
我的商店是:
fields: [
{ name: 'dateScanned', type: 'date', dateFormat: 'c' }
]
为什么标记点不起作用? 我怎样才能知道日期已格式化?
最佳答案
/*Override to allow textfields to format dates*/
Ext.override(Ext.field.Text, {
setValue: function (value) {
if (this.config.dateFormat && value) {
if (Ext.isDate(value)) {
value = Ext.Date.format(value, this.config.dateFormat);
}
else {
var d = new Date(value);
value = Ext.Date.format(d, this.config.dateFormat);
}
}
this.callSuper(arguments);
}
});
关于文本字段中的日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14771977/