我在extjs 3.4中使用网格,并且在网格中有一个包含日期的列。 现在我想在网格中显示之前更改日期格式。 为此,我使用以下两种代码方式
asm_profile_date_format ='F j,Y'
column = new Ext.grid.Column({
header : map['label'],
sortable : true,
dataIndex : map['name'],
renderer :Ext.util.Format.dateRenderer(asm_profile_date_format)
});
和
renderer : function(value)
{
if(value == null)
return ' '
else
{
return value.format(asm_profile_date_format);;
}
}
此处我获得的值/输入日期为 19/6/2013 ,但我获得的渲染器之后的日期为 2014年6月6日。
答案 0 :(得分:0)
我尝试了不同的组合,但无法做到。根本原因是,它将日期转换为月份(19 = 12 + 7),这意味着12到1年,7月到7月。我们需要手动转换并向用户显示。
我想建议的另一件事是,从后端以不同的格式输入值。尝试以日期格式返回,这将解决您的问题。