Extjs4 在extjs 4中以特定格式显示日期
我有一个网格,其中包含一个名为dateOfBirth的列 此列的类型为日期 我已经在我的web应用程序中显示了此列,但例如dateOfBirth的数据就是以这种格式显示的 2009年6月10日星期三16:11:53+0100 我的目标是以以下格式显示此日期:d/m/y 我尝试使用以下代码:Extjs4 在extjs 4中以特定格式显示日期,extjs4,Extjs4,我有一个网格,其中包含一个名为dateOfBirth的列 此列的类型为日期 我已经在我的web应用程序中显示了此列,但例如dateOfBirth的数据就是以这种格式显示的 2009年6月10日星期三16:11:53+0100 我的目标是以以下格式显示此日期:d/m/y 我尝试使用以下代码: var testGrid1 = Ext.create('Ext.grid.Panel', { id:'testGrid1 ', store: testGridStore,
var testGrid1 = Ext.create('Ext.grid.Panel', {
id:'testGrid1 ',
store: testGridStore,
collapsible:true,
columns: [
{text: 'test1', flex: 1, sortable: true, dataIndex: 'num_speech'},
{text: 'test2', flex: 1, sortable: true, dataIndex: 'dateOfBirth'}
],
columnLines: true,
anchor: '100%',
height: 250,
frame: true,
margin: '0 5 5 5',
});
正如我已经说过的,此代码以这种格式显示列的日期:Wed,Jun 2009 16:11:53+0100
为了解决这个问题,我尝试了很多方法,但没有成功
{text: 'test1', flex: 1, sortable: true, dataIndex: 'dateOfBirth',dateFormat: 'd/m/y'},
我有一个模型:
Ext.define('needUtilitesList', {
extend: 'Ext.data.Model',
fields: [
{name: 'dateOfBirth', type: 'date',dateFormat: 'd/m/y'},
{name: 'num_speech', type: 'string'}
]
});
但是它没有显示正确的结果您缺少了“type:‘date’,”所以
如果您有一个模型,还可以在其中指定dateOfBirth属性的类型,以便框架知道如何将其作为日期加载。-1。应该是
xtype:'datecolumn'
。另外,属性是format
,而不是dateFormat
。对不起,我昨晚一定在查看Ext.data.Field。埃文是对的。
{type:'date', flex: 1, sortable: true, dataIndex: 'dateOfBirth', dateFormat: 'd/m/y'}