You found a bug! We've classified it as EXTJSIII-241 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Jul 2014
    Posts
    7
    Vote Rating
    0
    gnagno is on a distinguished road

      0  

    Default Bugs on datefield dosen't fire blur

    Hi,
    i'm using ext 3.4
    I noticed that when i call method focus of an field, if the current field is a datafield, the event blur is not fired.
    As you can see after pressing the button click me the event is not fired. But it works if i click the mouse.

    Bye


    Code:
    Ext.onReady(function () {
    
        Ext.QuickTips.init();
    
        var myFormPanel = new Ext.form.FormPanel({
            renderTo: Ext.getBody(),
            width: 700,
            title: 'Test',
            height: 360,
            frame: true,
            id: 'myFormPanel',
            items: [
                {
                    fieldLabel: 'Data Creazione Da'
    , xtype: 'datefield'
    , format: 'd/m/Y'
    , id: 'mydate'
    , enableKeyEvents: 'true'
    , width: 100
    , maxLengthText: 10
    , minLengthText: 0,
                    listeners: {
                        'blur': function () {
                            console.log('mydate blur');
                        }
                    }
                },
                {
                    fieldLabel: 'Home',
                    xtype: 'textfield',
                    name: 'home',
                    id: 'home',
                    listeners: {
                        'blur': function () {
                            console.log('home blur');
                        }
                    }
                },
                {
                  xtype:'button',
                    text:'click me',
                    handler: function()
                    {
                        Ext.getCmp('mydate').focus();
                        setTimeout(function () {
    
                            Ext.getCmp('home').focus();
                        }, 2000);
                    }
    
                }
    
            ]
        });
    
    });

  2. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    6,626
    Vote Rating
    169
    Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold

      0  

    Default

    Thanks for the report. I added your code to this Fiddle:
    https://fiddle.sencha.com/#fiddle/j31

    I don't seem to be able to recreate the issue though. The blur event on the datefield fires for me whenever I do anything while focused on it, be it clicking the button, clicking into the other field or clicking outside of the fields. Any suggestions for me to reproduce this?
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

  3. #3
    Sencha User
    Join Date
    Jul 2014
    Posts
    7
    Vote Rating
    0
    gnagno is on a distinguished road

      0  

    Default

    Hi Gary,
    the problem is present also in fiddle.

    Here below another, i hope, clear example.
    Pressing the button Click the event Blur of my date is never fired

    Code:
    Ext.QuickTips.init();
    var focus;
    
    
    var myFormPanel = new Ext.form.FormPanel({
        renderTo: Ext.getBody(),
        width: 700,
        title: 'Test',
        height: 360,
        frame: true,
        id: 'myFormPanel',
        items: [{
            fieldLabel: 'Data Creazione Da',
            xtype: 'datefield',
            format: 'd/m/Y',
            id: 'mydate',
            enableKeyEvents: 'true',
            width: 100,
            maxLengthText: 10,
            minLengthText: 0,
            listeners: {
                'blur': function() {
                    console.log('mydate blur');
                }
            }
        }, {
            fieldLabel: 'Home',
            xtype: 'textfield',
            name: 'home',
            id: 'home',
            listeners: {
                'blur': function() {
                    console.log('home blur');
                }
            }
        }, {
            xtype: 'button',
            text: 'click me',
            handler: function() {
                Ext.getCmp('mydate').focus();
                focus = 1;
                changeFocus();
            }
    
    
        }]
    });
    
    
    
    
    function changeFocus()
    {
        if (focus == 1 ) { 
            Ext.getCmp('home').focus(); 
            focus=2;
        }else if (focus == 2) {
            Ext.getCmp('mydate').focus();
            focus = 1;
        }
        
        setTimeout(changeFocus, 4000);
        
    }
    s.jpg

  4. #4
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    6,626
    Vote Rating
    169
    Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold

      0  

    Default

    I see it now. Thanks for the report! I have opened a bug in our bug tracker.

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2008
    Posts
    406
    Vote Rating
    72
    rich02818 is infamous around these parts rich02818 is infamous around these parts

      0  

    Default

    Since the date field is a compound component similar to a combobox, this may very well be an old problem. See this post for a description of what happens with combobox (triggerfield):

    http://www.sencha.com/forum/showthread.php?244633 (..."However, if the ComboBox is exited programmatically and not in response to a direct user input, the blur does not happen. ")

    and this post for a possible work around:

    http://www.sencha.com/forum/showthre...l=1#post966060

    If you search "triggerBlur" in these forums you'll see several discussions of this problem.

Thread Participants: 2

Tags for this Thread