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?

有帮助吗?

解决方案

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

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