1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    19
    Vote Rating
    0
    abeal is on a distinguished road

      0  

    Default Answered: Combobox assertValue function

    Answered: Combobox assertValue function


    Hi,

    I had a quick question about the Ext.form.ComboBox assertValue private function. The source, at least for my version is here:
    Code:
        assertValue : function(){
            var val = this.getRawValue(),
                rec;
    
    
            if(this.valueField && Ext.isDefined(this.value)){
                rec = this.findRecord(this.valueField, this.value);
            }
            if(!rec || rec.get(this.displayField) != val){
                rec = this.findRecord(this.displayField, val);
            }
            if(!rec && this.forceSelection){
                if(val.length > 0 && val != this.emptyText){
                    this.el.dom.value = Ext.value(this.lastSelectionText, '');
                    this.applyEmptyText();
                }else{
                    this.clearValue();
                }
            }else{
                if(rec && this.valueField){
                    // onSelect may have already set the value and by doing so
                    // set the display field properly.  Let's not wipe out the
                    // valueField here by just sending the displayField.
                    if (this.value == val){
                        return;
                    }
                    val = rec.get(this.valueField || this.displayField);
                }
                this.setValue(val);
            }
        },
    My question specifically has to do with these lines:
    Code:
                if(val.length > 0 && val != this.emptyText){
                    this.el.dom.value = Ext.value(this.lastSelectionText, '');
                    this.applyEmptyText();
                }else{
                    this.clearValue();
                }
    Does it make sense for the assertion function to be doing the actual clearing? I'm in the process of adding a 'clear' event to be fired from the body of this code, as I want some other classes to be notified when this field clears itself. I wondered that I did not find the clearing done in either TextField's 'applyEmptyText' function, or in the Combobox 'clearValue' function, rather than here.

    If y'all feel it's legit, no worries; just curious.

  2. That code appears to be from ExtJS 3. This is an ExtJS 4 forum.

    That method has changed significantly between ExtJS 3 and 4:

    http://docs.sencha.com/ext-js/4-0/so...ethod-getStore

    which may go some way towards answering your question.

  3. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,345
    Answers
    499
    Vote Rating
    250
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    That code appears to be from ExtJS 3. This is an ExtJS 4 forum.

    That method has changed significantly between ExtJS 3 and 4:

    http://docs.sencha.com/ext-js/4-0/so...ethod-getStore

    which may go some way towards answering your question.

  4. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    19
    Vote Rating
    0
    abeal is on a distinguished road

      0  

    Default


    It does, or at least, it renders it moot. Thanks for the response.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar