View Full Version : Form inside Window problem

28 Apr 2009, 3:38 AM
hi to all

i'm having some hard time to find the solution for this.

new Ext.Window({
,title:'Novo Contacto'
,autoDestroy: false
,items: [contacto_form]

where contacto_form is a very simple form.

my problem is that it works first time but when close and re-open the window, form don't show up.

i have a similar problem with tabs and tried to solved it in the same way but nothing appears to work. i do believe that it have a very easy solution...i simple can't find it


28 Apr 2009, 3:54 AM
conctacto_form should be a configuration object.
Else, you'll need to use a singleton.

28 Apr 2009, 3:59 AM
is it possible to explain it in english? :P cuz now im confused

28 Apr 2009, 4:14 AM
contacto_form should be something like:

var contacto_form = {
xtype : 'form',
items : [ ... formpanel items ... ]

instead of

var contacto_form = new Ext.form.FormPanel();

you are getting bit by not knowing about the container model and some object oriented principles.

See this screencast for more details:

28 Apr 2009, 4:26 AM
Or use closeAction: 'hide', and just reshow the same Window next time.

28 Apr 2009, 5:45 AM
jgarcia & animal: tks for your answer.both have been my salvation more then once already :D

jgarcia: your solution worked!many tks!

animal: that was exactly what i was trying to achieve! tried with autoDestroy:false but no success. tried your solution first but the behavior is very weird! window is only closed first time. when re-open 2 things hapen:

if form not a config object window is opened very very small(only window title width) and is not possible to close it again...
if form is a config object window is opened and add the form fields to the already existing ones.again is not possible to close it...very weird behavior ...:-?

28 Apr 2009, 5:55 AM
What do the docs for autoDestroy say?

Read the docs for closeAction.

28 Apr 2009, 6:03 AM
tks...will do that