1. #1
    Ext User
    Join Date
    Nov 2007
    Posts
    9
    Vote Rating
    0
    JeffG is on a distinguished road

      0  

    Default [1.1.1/2.0] Clearing the ComboBox input selects the previously selected value

    [1.1.1/2.0] Clearing the ComboBox input selects the previously selected value


    I posted this in http://extjs.com/forum/showthread.php?t=18832, but thought I'd move it to the appropriate forum and see what everyone thought. Please read through the other thread for a little background


    This is going to work in my case. No guarantees it will work for anyone else, and I take no responsibility if you try it

    Change to ext-all-debug.js (2.0alpha1) at line 26673. The combobox onLoad..
    PHP Code:
    onLoad : function(){
             if(!
    this.hasFocus){
                 return;
             }
             if(
    this.store.getCount() > 0){
                 
    this.expand();
                 
    this.restrictHeight();
                 if(
    this.lastQuery == this.allQuery){
                     if(
    this.editable){
                         
    this.el.dom.select();
                     }
                     if(!
    this.selectByValue(this.valuetrue)){
                         
    this.select(0true);
                     }
                 }else{
                     
    this.selectNext();
                     if(
    this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
                         
    this.taTask.delay(this.typeAheadDelay);
                     }
                 }
             }else{
                 
    this.onEmptyResults();
             }
         }, 

    The change..
    PHP Code:
    if(!this.selectByValue(this.valuetrue)){ 
    to
    PHP Code:
    if(!this.selectByValue(this.allQuerytrue)){ 
    This is going to work for me because I set to allQuery='' (which is also the default). Let's step through..

    Delete the input text, and now this.lastQuery == this.allQuery. The blank text never makes it into this.value -- it remains the same as the last one you selected.

    Since this is case, I think it makes more sense to call this.SelectByValue() with the allQuery value. And guess what! I just so happen to have a blank value to my datastore so now it gets selected.

    I'm struggling to figure out why you would want to pass this.value even if allQuery was not blank, but then I do have a hard time thinking like other people.

    Say you have allQuery = 'all' then they type 'all' in the input. I'd think you'd first want to check to see if 'all' is also a valid value in your list, then if not select the first in the list rather than looking up the previously selected value.

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    just to confirm:

    the thread you referenced is from the 1.x Help forum, and you've reposted the same thing here in the 2.x Bugs forum because you've experienced the same issue in the official 2.0 final download?

  3. #3
    Ext User
    Join Date
    Nov 2007
    Posts
    9
    Vote Rating
    0
    JeffG is on a distinguished road

      0  

    Default


    Quote Originally Posted by mystix View Post
    just to confirm:

    the thread you referenced is from the 1.x Help forum, and you've reposted the same thing here in the 2.x Bugs forum because you've experienced the same issue in the official 2.0 final download?
    Correct, when I was first researching my issue, I found the thread in 1.x and replied. I am using 2.0 so I reposted here in Bugs.
    Last edited by JeffG; 5 Jan 2008 at 4:56 PM. Reason: Clarity

  4. #4
    Ext User
    Join Date
    Nov 2007
    Posts
    9
    Vote Rating
    0
    JeffG is on a distinguished road

      0  

    Default


    Was this fixed in 2.0.1?

    Combobox:
    - clearValue now clears this.value

Thread Participants: 1