Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
失去焦点后ExtJS网格时间域编辑器更改值_Extjs_Extjs4_Extjs4.2 - Fatal编程技术网

失去焦点后ExtJS网格时间域编辑器更改值

失去焦点后ExtJS网格时间域编辑器更改值,extjs,extjs4,extjs4.2,Extjs,Extjs4,Extjs4.2,我有一个网格,对于一个单元格,我使用TimeField编辑器: { text: 'InTime', dataIndex: 'InTime', editor: { xtype: 'timefield', format: 'H:i', // 24 hour format altFormats: 'H:i', // 24 hour format selectOnFocus: true, minVal

我有一个网格,对于一个单元格,我使用
TimeField
编辑器:

{
    text: 'InTime',
    dataIndex: 'InTime',
    editor: {
        xtype: 'timefield',
        format: 'H:i', // 24 hour format
        altFormats: 'H:i', // 24 hour format
        selectOnFocus: true,
        minValue: '12:00 AM',
        increment: 60,
        maxValue: '11:00 PM'
    }
我的单元格在编辑之前和编辑时如下所示:

此时,一切正常,当我打开下拉列表时,一切看起来也正常:

但在我从列表中选择一个值并更改为其他单元格后,该单元格中更新的值是datetime字符串格式的文本,如下所示:

有人知道为什么会这样吗


谢谢

除了我在你另一篇关于H:I是24小时制的帖子上留下的内容之外。
如果需要格式化字符串,请使用field.getRawValue()而不是getValue()获取字段值。

在编辑器渲染器中使用format
format:'g:ia'
,在网格单元格字段中使用Ext.util.format.dateRenderer('g:ia')

{
text: 'InTime',
renderer: Ext.util.Format.dateRenderer('g:i A')
dataIndex: 'InTime',
editor: {
    xtype: 'timefield',
    format: 'H:i', // 24 hour format
    altFormats: 'H:i', // 24 hour format
    selectOnFocus: true,
    minValue: '12:00 AM',
    increment: 60,
    maxValue: '11:00 PM'
}

这是因为您必须始终指定渲染器,否则将使用数据值的
toString
(日期
)。网格不会像编辑器(组合)那样神奇地渲染它。

您必须始终指定渲染器,否则将使用数据值的
toString
。网格不会像编辑器(组合)那样神奇地渲染它。就像你有一个常规的组合框下拉列表一样。看见