0

I have a datefield xtype mentioned in my grid's date column editor, once I select any date from the picker, as long as I don't click outside or press Enter, the date is displayed in the default format i.e. 'd/m/Y' (meaning dd/mm/YYYY). But as soon as I click outside of the cell or press enter it changes to an entire date containing the timestamp as well. How do I not let this happen? I want to keep it in d/m/Y format and don't want time or day to be displayed.

Here is an example of what it becomes once I press enter.

Tue May 28 2013 00:00:00 GMT +0530 (India Standard Time)

I want it to be

28/05/2013 or Tue 28/05/2013

How to do this?

My configuration for the column is given below

editor: {
    xtype: 'datefield',
    anchor: '100%',
    format: 'd/m/Y',
    submitFormat: 'd/m/Y',
    minValue: new Date()
}
4

3 回答 3

1

1 在模型中定义日期字段 -

{名称:'日期',类型:'日期',日期格式:'Y/m/d'}

2 在您使用日期选择器的网格的列配置中使用以下内容 -

{标题:'日期',xtype:'datecolumn',宽度:200,dataIndex:'date',编辑器:{xtype:'datefield',格式:'Y/m/d',allowBlank:'fasle'}}
于 2013-05-28T17:19:09.823 回答
0

当您使用日期字段时,它会在模型​​上设置日期类型。

在网格单元上使用渲染器(假设字段的类型为日期):

{
    xtype: 'datecolumn',
    dataIndex: 'myDate',
    text: 'Date',
    format: 'Y-m-d'
}
于 2013-05-28T11:00:03.573 回答
0

Please refer below code and let me know whether it works!

editor: {
    xtype: 'datefield',
    anchor: '100%',
    format: 'd/m/Y',
    submitFormat: 'd/m/Y',
    minValue: new Date(),
    listeners : {
               render : function(datefield) {
                   // code to convert GMT String to date object
                   datefield.setValue(new Date());
               }
    }
}

Thanks

于 2013-05-28T10:49:00.497 回答