Search code examples
sencha-touch-2

Sencha Touch selectfield change event not working with different value but same text


The selectfield change event not working with different value but same text. Demo here:- https://fiddle.sencha.com/#fiddle/jat

Ext.create('Ext.form.Panel', {
    fullscreen: true,
    items: [
        {
            xtype: 'fieldset',
            title: 'Select',
            items: [
                {
                    xtype: 'selectfield',
                    label: 'Choose one',
                    options: [
                        {text: 'First Option',  value: 'first'},
                        {text: 'Second Option', value: 'second'},
                        {text: 'Second Option',  value: 'third'}
                    ],
                    listeners:{
                        change:function(selectfield,newValue,oldValue,eOpts){
                            alert(newValue);
                        }
                    }

                }
            ]
        }
    ]
});

Solution

  • setValue: function(newValue) {
        var oldValue = this._value;
    
        this.updateValue(this.applyValue(newValue));
    
        newValue = this.getValue();
        //alert(newValue)
        if (this.initialized) {
            this.onChange(this, newValue, oldValue);
        }
    
        return this;
    }
    

    this is the working solution for this.