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?

Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top