我曾经在6.2.0中通过这样做来设置日期字段中的时间。
select: function (cmp, v) {
var d = v;
d.setHours(23);
d.setMinutes(59);
d.setSeconds(59);
cmp.setValue(d);
}但现在在ExtJs7中,setValue()也将触发select事件。所以,它变成了一个循环。
因此,有没有其他方法可以在日期字段中设置时间?
发布于 2020-11-06 06:33:53
您可以使用'submitFormat‘配置属性来设置日期的默认时间:
Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 300,
bodyPadding: 10,
title: 'Dates',
items: [{
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'To',
name: 'to_date',
value: new Date(),
submitFormat: 'Y-m-d 23:59:59' // <-- THIS ONE
}],
buttons: [{
text: "Show Values",
handler: function() {
console.log(this.up('form').getValues());
}
}]
});https://stackoverflow.com/questions/64674233
复制相似问题