문제

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