PDA

View Full Version : how to give default focus in textfield of the Form Panel



majid mir
26 May 2010, 6:20 AM
Hi,

This is very urgent anyone have answer...

I have extend the numberField class like this Ext.extend(Ext.form.NumberField,

and used in the form panel as an item

for example


xtype:

'x-clfw-cldecimalfield'



and this is editable numberfield




Problem:




I want when this form panel load it should get first focus on this numberfield which is 3rd items of the form panel




anyone have answer how to give default focus on any numberfield or textfield




Thanks,

Condor
26 May 2010, 6:42 AM
formPanel.on('afterlayout', function(){
myField.focus();
}, null, {single: true});
(or is this form part of a window?)

majid mir
26 May 2010, 9:23 PM
Thanks condor

yes this form is part of window
i have add this form in the window popup class and this open when we double click on gird row.

Condor
26 May 2010, 11:36 PM
If the form is part of a window then you should simply configure your window with:

defaultButton: 'id-of-field'

majid mir
27 May 2010, 12:42 AM
form panel is part of window.. and and numberfield which i have to give set focus is a a part ofr form panel

so what u are finally sugguesting
this code will work

formPanel.on('afterlayout', function(){
myField.focus();
}, null, {single: true});

majid mir
27 May 2010, 5:52 AM
Thanks condor

defaultButton confirm work in window to give focus