PDA

View Full Version : field.blur() don't seem to work with date-, numberfields and comboboxes



taavih
17 Dec 2011, 4:48 AM
Problem being solved: lose fields focus.
First logical solution: field.blur(), where field is the element that has focus
Problem appeared: field.blur() works only if field is textfield
Ext version: 4.0.1

Tried it with date-, numberfields and comboboxes.

Is this bug or something that I have done wrong?

Or is there any other way to lose field focus?

Many thanks in advance!

mitchellsimoens
17 Dec 2011, 7:08 AM
I don't have 4.0.1, the earliest I have is 4.0.2a and this works:


var form = Ext.create('Ext.form.Panel', {
renderTo : Ext.getBody(),
width : 400,
height : 400,
title : 'Test',
items : [
{
xtype : 'textfield',
fieldLabel : 'Text'
},
{
xtype : 'datefield',
fieldLabel : 'Date'
}
],
dockedItems : [
{
xtype : 'toolbar',
dock : 'bottom',
items : [
{
text : 'Blur Text',
handler : function() {
var text = form.down('textfield');

text.blur();
}
},
{
text : 'Blur Date',
handler : function() {
var date = form.down('datefield');

date.blur();
}
}
]
}
]
});