如何使用xtype:“ datefield”单击“今日”按钮来添加自定义代码
例如:在点击“今天”按钮后添加自定义日期。
Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 300,
bodyPadding: 10,
title: 'Dates',
items: [{
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
maxValue: new Date() // limited to the current date or prior
}]
});
正如@ A1rPun所建议的,这是一个从选择器中获取按钮的实现。
var picker = Ext.create('Ext.form.field.Date', {
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
maxValue: new Date()
});
var field = Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 400,
height: 400,
title: 'Dates',
items: [picker]
});
picker.getPicker().todayBtn.on('click', function() {
alert('hello');
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句