I am trying to fill a datefield with todays date by doubleclicking the datefield. now I have no clickevent for xtype: datefield.

is it possible to still 'add' a doubleclick event to a datefield, or is there another workaround??

example code:

xtype: 'datefield',
name: 'reminderDate',
itemId: 'reminderDate',
fieldLabel: 'Erinnerung am',
padding: '10',
style: 'background-color: red'
有帮助吗?

解决方案

Ext.form.field.Date does not have dblclick event. However after component is rendered you can bind listener for dblclick event on datefield input element. You can get datefield input element from Ext.form.field.Date inputEl property.

xtype: 'datefield',
fieldLabel: 'Date',
name: 'date',
listeners: { 
    afterrender: function(c) {
        c.inputEl.on('dblclick', function(){
            c.setValue(new Date());
        });
    }
}

Live fiddle with example: https://fiddle.sencha.com/#fiddle/2bo

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top