PDA

View Full Version : [FIXED-1112]focus(true,true) only returns the Field's this if called without timeout



Ian Young
8 Jul 2010, 9:42 AM
in 3.1 and 3.2.1.

You could also call this a "Documentation Bug" because if this is by design, the API docs should note strongly that Ext.Component is only returned if it's not fired later.


var foo = new Ext.Window({})
Returns: undefined

foo.show()
Returns: Object

var bar = new Ext.form.FormPanel({})
Returns: undefined

foo.add(bar)
Returns: Object

foo.doLayout()
Returns: undefined

baz = new Ext.form.TextField({});
Returns: Object

bar.add(baz)
Returns: Object

foo.doLayout()
Returns: undefined

baz.focus(true,true)
Returns: undefined

baz.focus(true)
Object

Animal
8 Jul 2010, 9:53 AM
Yes, look at the source. It's an omission:



focus : function(selectText, delay){
if(delay){
this.focusTask = new Ext.util.DelayedTask(this.focus, this, [selectText, false]);
this.focusTask.delay(Ext.isNumber(delay) ? delay : 10);
return; <--- needs to return this
}
if(this.rendered && !this.isDestroyed){
this.el.focus();
if(selectText === true){
this.el.dom.select();
}
}
return this;
},

evant
8 Jul 2010, 9:09 PM
Fixed in SVN, thanks for the report.