I have a DateField:
editor : new Ext.form.DateField({ /*Ext.ux.form.Custom*/
allowBlank: true,
format: 'm/d/Y',
width : 120,
enableKeyEvents: true,
listeners: {
'keydown' : function (field_, e_ ) {
field_.onTriggerClick();
e_.stopEvent();
return false;
},
'focus' : function (field_ ) {
field_.onTriggerClick();
e_.stopEvent();
return false;
}
}
})
Editing of this field is disabled. On any edit, it shows popup, so any clear of date is impossible. Is there a way to add to popup something like button Today, but meaning Clear, after which date in this field will be resetted to 00.00.00?
Thanks.
Try something like this:
{
xtype: 'datefield',
onTriggerClick: function() {
Ext.form.DateField.prototype.onTriggerClick.apply(this, arguments);
var btn = new Ext.Button({
text: 'Clear'
});
btn.render(this.menu.picker.todayBtn.container);
}
}
It's very dependent on implementation, but it works. And you must flag it that way it won't render another clear button every time you click the trigger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With