Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    47
    Vote Rating
    0
    Andrew Peacock is on a distinguished road

      0  

    Default [OPEN-1224] Combobox click on "empty text" issue

    [OPEN-1224] Combobox click on "empty text" issue


    Hi,
    I'm seeing the exact same problem as described here, only 1 year later on, and on ExtJS3.2.1 rather than GWT 2.0

    I'm seeing the issue across multiple comboboxes. But only in Firefox (.0 work3.5.11 - I've not tested other versions) . IE7.0 works fine: you can click anywhere within the combobox and the drop-down expands.

    Sample code (on Ext 3.2.1)

    Code:
    Ext.onReady(function() {
        Ext.BLANK_IMAGE_URL = 'images/s.gif';
    
    
    
        var genres = new Ext.data.SimpleStore({
            fields: ['id', 'genre'],
            data : [['1','Comedy'],['2','Drama'],['3','Action']]
        });
    
        var movie_form = new Ext.FormPanel({
            renderTo: document.body,
            frame: true,
            title: 'Test Form',
            items: [{
                xtype: 'combo',
                id: 'testCombo',
                fieldLabel: 'Genre',
                name: 'genre',
                emptyText: 'Select a genre...',
                selectOnFocus: true,
                editable: false,
                forceSelection: true,
    
                mode: 'local',
                store: genres,
                displayField:'genre'
    
            }]
        });
    
        Ext.util.Observable.capture(Ext.getCmp('testCombo'), console.info);
    });
    I've added an observer, and it seems that when clicking on the "empty text", only the focus event is received. But clicking on the whitespace gives focus, beforequery, expand.

    It also only seems to be if the empty text is showing - if I've made a selection, then go to change it, the entire combox again expands the list.

    Anyone got any clues why this is happening?

    Regards,
    Andy

  2. #2
    Ext JS Premium Member Spenna's Avatar
    Join Date
    Apr 2008
    Posts
    65
    Vote Rating
    0
    Spenna is on a distinguished road

      0  

    Default


    I've got the exact same issue, and its in firefox only.
    From my testing/debugging its been like this since the 3.x branch, but unfortunately i've not been able to fix the issue.
    It works as expected in version 2.1 though..

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Clicking on the emptyText will first fire a 'focus' event which will remove the emptyText.

    After that a click event should fire, but the event target (in Firefox this is an internal element that held the emptyText) no longer exists, so the click event doesn't bubble up to the <input> element.

    You could fix this by using the mousedown event instead of click event in TriggerField.updateEditState, but I don't know if this will create other problems elsewhere (grid editors come to mind).

    ps. I'm going to move this thread to the Bugs section.

  4. #4
    Ext JS Premium Member Spenna's Avatar
    Join Date
    Apr 2008
    Posts
    65
    Vote Rating
    0
    Spenna is on a distinguished road

      0  

    Default


    Works like a charm, no repercussions identified, tested in IE/FF/Opera/Safari

    Basically i did an override of the combobox component (for those interested):

    Code:
    Ext.override(Ext.form.ComboBox, {
        updateEditState: function(){
            if(this.rendered){
                if (this.readOnly) {
                    this.el.dom.readOnly = true;
                    this.el.addClass('x-trigger-noedit');
                    this.mun(this.el, 'mousedown', this.onTriggerClick, this);
                    this.trigger.setDisplayed(false);
                } else {
                    if (!this.editable) {
                        this.el.dom.readOnly = true;
                        this.el.addClass('x-trigger-noedit');
                        this.mon(this.el, 'mousedown', this.onTriggerClick, this);
                    } else {
                        this.el.dom.readOnly = false;
                        this.el.removeClass('x-trigger-noedit');
                        this.mun(this.el, 'mousedown', this.onTriggerClick, this);
                    }
                    this.trigger.setDisplayed(!this.hideTrigger);
                }
                this.onResize(this.width || this.wrap.getWidth());
            }
        }
    });

  5. #5
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    13
    Vote Rating
    0
    Shn is on a distinguished road

      0  

    Default


    Thank you Spenna for that fix, it's working for me as well.

    I modified the first line so it would override Ext.form.TriggerField instead, as I use plugins which extend it and require that fix (such as Ext.ux.form.CheckboxCombo). Is there any reason why I shouldn't do so ? It doesn't seem to pose any problems to other triggerfields...

  6. #6
    Sencha User Jaitsu's Avatar
    Join Date
    Sep 2008
    Location
    Liverpool, England
    Posts
    160
    Vote Rating
    1
    Jaitsu has a spectacular aura about Jaitsu has a spectacular aura about

      0  

    Default


    Quote Originally Posted by Shn View Post
    Thank you Spenna for that fix, it's working for me as well.

    I modified the first line so it would override Ext.form.TriggerField instead, as I use plugins which extend it and require that fix (such as Ext.ux.form.CheckboxCombo). Is there any reason why I shouldn't do so ? It doesn't seem to pose any problems to other triggerfields...
    Like Condor said, if you override the TriggerField you may experience problems with editors on grid components. Just make sure you do some testing.

  7. #7
    Ext User
    Join Date
    Jul 2010
    Posts
    27
    Vote Rating
    1
    robando is on a distinguished road

      0  

    Default


    Thanks so much for this fix. It helped me work around the same issue other people have stated here. One new issue I'm seeing once I put this fix in is that the first time I open the dropdown it has a scrollbar. Once its been closed and then reopened the scrollbar goes away. Any ideas what might be causing this?

Similar Threads

  1. ComboBox Empty Text
    By bkoh in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 6 Aug 2009, 1:27 AM
  2. combobox: click in empty field doesn't trigger
    By clf in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 4 Aug 2009, 9:06 PM
  3. [INFOREQ]3.0 combobox: click in empty field doesn't trigger
    By clf in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 4 Aug 2009, 2:27 PM

Thread Participants: 5