Results 1 to 2 of 2

Thread: Ext.field.Select: reset()

    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
    303
    Vote Rating
    1
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

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