我是 ext js 新手 如果我无法正确解释我的问题,我很抱歉
我的问题是网格中的时间字段显示为空白
如果将模型中的日期类型更改为字符串并禁用渲染功能 formatTime ,则会显示该值。
下面是响应json、模型和 View 的部分。我已经从另一个工作站点复制了代码。
请告诉我如何调试并找到解决方案以及可能的原因
Extjs 4.2 mvc
json 响应中的值
"actualstarttime":"02:00 AM"
型号
{name: 'actualstarttime', type: 'date'},
查看
{
header: 'Time',
dataIndex: 'actualstarttime',
width: 85,
renderer: this.formatTime,
editor: {
xtype: 'timefield',
id : 'e_actualstarttime',
/*allowBlank: false,*/
minValue: '12:00 AM',
maxValue: '23:00 PM',
increment: 30,
anchor: '100%',
editable : false,
format: 'h:i A',
submitFormat: 'h:i A',
listeners: {
change: function(roweditor, changes, record, rowIndex) {
me.calculateInterval(roweditor, changes, record, rowIndex);
},
afterrender: function( roweditor, changes, record, rowIndex ) { //TECHNOKRAFTS: Added Listner to apply validation depending on the status
me.checkstatusvalidation(roweditor, changes, record, rowIndex);
}
}
}
}
渲染中调用 Formattime 函数
formatTime : function (value){
return value ? Ext.Date.dateFormat(value, 'g:i A') : '';
}
最佳答案
您需要将dateFormat
添加到您的字段定义中。
Ext.define("Model", {
extend: "Ext.data.Model",
fields: [{
name: "actualstarttime",
format: "h:i A"
}]
});
关于javascript - Ext Js面板空时间字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26195903/