Question

An Ext.field.Toggle status can be changed programmatically using the .toggle() or .setValue() methods. This however doesn't trigger the animation on the component like it was actually dragged or tapped. Is there a way to obtain that?

Était-ce utile?

La solution

Solved it by firing tap on the underlying element of the Ext.slider.Toggle contained in the Ext.field.Toggle:

Ext.define('Fiddle.CustomToggle', {
    extend: 'Ext.field.Toggle',
    xtype : 'customtogglefield',

    toggle: function() {
        this.getComponent().element.fireEvent('tap');
    }

});

Example at https://fiddle.sencha.com/#fiddle/669

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top