[英]Extjs date column format
我有日期字段编辑器的日期列。 问题是,在即时编辑列中,它显示的是正常值,例如2013-02-05
,但是在关闭编辑时,其显示的内容类似于Sat Jul 12 2014 00:00:00 GMT+0300 (FLE Standard Time)
我的代码:
{
xtype : 'datecolumn',
dataIndex : 'depreciationStartPeriod',
header : 'Depreciation start period',
sortable : true,
id : 'depreciationStartPeriod',
width : 134,
editor : {
xtype : 'datefield',
format: 'Y-m-d H:i:s'
}
}
商店领域:
{
name : 'depreciationStartPeriod',
type : 'String',
dateFormat: 'c'
}
原因可能是什么?
更新
在商店中由于某种原因它也以错误的格式保存,这就是为什么它以这种格式显示的原因,但是我现在不这样做了。
{
xtype : 'datecolumn',
dataIndex : 'depreciationStartPeriod',
header : 'Depreciation start period',
sortable : true,
id : 'depreciationStartPeriod',
width : 134,
format: 'Y-m-d H:i:s', // <------- this way
editor : {
xtype : 'datefield',
format: 'Y-m-d H:i:s',
submitFormat: 'c' // <-------------- this way
}
}
您需要将store字段设置为date
类型,而不是string
。 因为它当前是一个字符串,所以ExtJS直接从datefield.getValue().toString()
,这就是使它获得完整格式的原因。
还要注意,即使您想使用string
作为type
,该单词也应该完全小写(您目前拥有String
)。 查看此链接以获取可以使用的有效type
参数: http : //docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Field-cfg-type
尝试将存储中的类型指定为Ext.data.Types.DATE我通过将类型更改为Ext.data.Types.DATE解决了类似的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.