Results 1 to 3 of 3

Thread: field.Combobox on focus bug

  1. #1
    Sencha User
    Join Date
    Jun 2017

    Default field.Combobox on focus bug

    hey everyone,
    i've been struggling with the event focus for a few days now, it turns out its not only with the combobox, but with alot of components.

        name: 'Fiddle',
        launch: function () {
            var store = Ext.create('', {
    	        		data: []
            var combobox = Ext.create('Ext.form.field.ComboBox', {
               store : store,
               displayField: 'label',
               valueField: 'value',
               queryMode: 'local', // <---- THIS FIXED THE ISSUE
               listeners: {
                   focus: function(field, event, eOpts) {
    					var blueRec = {
    	                    value: 'blue',
    	                    label: 'Blue'
    	                var redRec = {
    	                    value: 'red',
    	                    label: 'Red'
    	                var greenRec = {
    	                    value: 'green',
    	                    label: 'Green'
            var panel = Ext.create('Ext.form.Panel', {
                title: 'Test Form Panel',
                items: [combobox]
                ,renderTo: Ext.getBody()
    For some reason it goes into an infinite loop and i keep getting the alert over and over non stop.

    Any ideas why this is happening ?

  2. #2
    Sencha User
    Join Date
    Jul 2017


    What's happening is you click the ComboBox (or whatever component) thus giving it focus, which fires the 'focus' event. The focus listener you've defined creates the popup alert, which takes focus away from the ComboBox. After dismissing the popup, focus automatically returns back to the ComboBox, then firing the focus event again.

    I'm not sure why changing the queryMode to 'local' fixed it for you, it didn't seem to make a difference either way for me. A better way to test this would be to use 'console.log("Done")' instead of the alert, so that the focus isn't getting disrupted.

  3. #3
    Sencha User
    Join Date
    Jun 2017


    @Glita9p Thanks a lot for the reply.

    You are right, the queryMode : 'local' // this fixed the issue was referring to another problem, and not this one. My bad I should've removed it.
    Anyway you are right, this is exactly whats happening, and i think i have an idea how to avoid this.

    The idea is in the 'focus' event ill unsubscribe the event at the first line, then comes the code what i wanna do in that event, and finally ill subscribe the event back, this way when the combobox gets the focus back, it wont fire the focus event again, and the event will be subscribed again when the code is done.

    If i fix this ill post the solution here, and thanks a lot for the help.

Similar Threads

  1. Replies: 2
    Last Post: 11 Jun 2012, 2:00 AM
  2. Combobox change event does not till focus it loose focus?
    By saadkhan in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 6 Mar 2010, 8:26 AM
  3. ComboBox selected value not set when changing field focus
    By spotk in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 24 Nov 2008, 11:10 PM

Tags for this Thread

Posting Permissions

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