PDA

View Full Version : Form inside Window problem



SchattenMann
28 Apr 2009, 3:38 AM
hi to all

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



new Ext.Window({
id:'window_novo_contacto'
,title:'Novo Contacto'
,layout:'fit'
,autoWidth:true
,closable:true
,border:false
,hideMode:'offsets'
,deferredRender:false
,autoDestroy: false
,items: [contacto_form]
}).show()


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

tks

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

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

jay@moduscreate.com
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:
http://tdg-i.com/58/ext-js-screencast-005-containers-add-and-remove

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

SchattenMann
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 ...:-?

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

Read the docs for closeAction.

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