Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    266
    Vote Rating
    0
    nak1 is an unknown quantity at this point

      0  

    Default Ext.field.Select: reset()

    Ext.field.Select: reset()


    So I was doing some testing and it seems that the Ext.field.Select's reset method is not being properly called when you call the Ext.form.Panel's reset() method is called. It seems to call the Ext.field.Text's reset method.

    Furthermore the Ext.field.Select reset method is as follows:
    Code:
    reset: function() {
            var store = this.getStore(),
                record = (this.originalValue) ? this.originalValue : store.getAt(0);
    
            if (store && record) {
                this.setValue(record);
            }
    
            return this;
        }
    However if you notice this code, it's defaulting the select to be the first record if an orginalValue wasn't set. This, however, is in my opinion is incorrect, because the select might have been blank and then when the reset method is ran, it will not be set to the first item.

    What I did was override the method to the following:
    Code:
    Ext.define('Ux.field.Select',{
    			override: 'Ext.field.Select',
    			reset:function(expr){
    				var store = this.getStore(),
    		            record = (this.originalValue) ? this.originalValue : null;
    				
    		        if (store && record) {
    		            this.setValue(record);
    		        }
    				else{
    					this.setValue(null);
    				}
    		        return this;
    				}
    		})
    I'm not certain that this is a bug, more then I feel it's a flaw in the way the process behaves for the Ext.field.Select.
    No longer a Newbie

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,641
    Vote Rating
    898
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    When the select field is first shown, if a value was not passed, the value defaults to the first record in the store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1