Thank you for reporting this bug. We will make it our priority to review this report.
-
Sencha User
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);
}
}
]
});
});
-
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?
-
Sencha User
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
-
I see it now. Thanks for the report! I have opened a bug in our bug tracker.
-
Ext JS Premium Member
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.