Results 1 to 3 of 3

Thread: Select field not firing change event on same text but different value

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    21

    Default Select field not firing change event on same text but different value

    I need to listen the change event on a select field (Ext.field.Select) with several options displaying the same text (but different value).

    The issue is that the event won't fire if the new display is the same as the previous one, regardless of the internal value of that option (the one .getValue() returns ).

    The selectField delegates the change listener to its input component (Ext.field.Input) which will fire it from its setValue function. The setValue function validates if the new display text is the same as the previous one and since its true doesn't fires the event.



    Notice that all the values are different but 3 of the displays are the same.
    Going from the first 2 values to one of the 'Third Option' will fire the event, but going from one of those to another with the same display will not fire it.

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3

    Default We can override this selectfield.

    Hi found something for you, i got this one. May this help for your bug.

    Code:
    Ext.override(Ext.field.Input,{        setValue:function(newValue){var oldValue =this._value;this.updateValue(this.applyValue(newValue));            newValue =this.getValue();this.onChange(this, newValue, oldValue);returnthis;}});
    Code:
    Ext.application({
        name: 'Fiddle',
    
    
        launch: function() {
            Ext.override(Ext.field.Input, {
            setValue: function (newValue) {
                var oldValue = this._value;
    
    
                this.updateValue(this.applyValue(newValue));
    
    
                newValue = this.getValue();
                this.onChange(this, newValue, oldValue);
    
    
                return this;
            }
        });
            var select = Ext.create('Ext.field.Select', {
                label: 'Choose one',
                options: [{
                    text: 'First Option',
                    value: 'first'
                }, {
                    text: 'Second Option',
                    value: 'second'
                }, {
                    text: 'Third Option',
                    value: 'third'
                }, {
                    text: 'Third Option',
                    value: 'fourth'
                }, {
                    text: 'Third Option',
                    value: 'fifth'
                }],
                listeners: {
                    change: function(iobListField, iobNewValue, iobOldValue) {
                        Ext.Msg.alert('Value', 'Selected value:' + iobNewValue, Ext.emptyFn);
                        console.log(iobNewValue);
                    }
                }
            });
            Ext.Viewport.add({
                items: select
            });
        }
    });
    Reference :
    http://stackoverflow.com/questions/3...40971#32740971

Similar Threads

  1. Ext.field.Select Change Event Unintentional Firing?
    By oddz in forum Sencha Touch 2.x: Q&A
    Replies: 4
    Last Post: 22 Jun 2012, 2:18 AM
  2. Replies: 2
    Last Post: 12 Aug 2011, 1:13 PM
  3. Select not firing change event
    By lukasz_b in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 4 Nov 2010, 6:49 AM
  4. Event change on select with datastore not firing
    By steve1964 in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 18 Sep 2010, 5:34 AM
  5. Change listener firing multiple times on select field
    By meyerovb in forum Sencha Touch 1.x: Bugs
    Replies: 0
    Last Post: 30 Jun 2010, 7:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •