PDA

View Full Version : FormPanel not rendered



spor
22 Mar 2010, 3:54 AM
I am wondering why the form isn't rendered to the html page?

var fp = new Ext.form.FormPanel({
renderTo : Ext.getBody(),
width : 400,
height : 160,
title : 'Exercising textfields',
frame : true,
bodyStyle : 'padding: 6px',
labelWidth : 126,
defaultType : 'textfield', // 1
defaults : {
msgTarget : 'side', // 2
anchor : '-20'
},
items : fpItems
});

Condor
22 Mar 2010, 3:57 AM
Are you creating this form from within Ext.onReady?

spor
22 Mar 2010, 4:14 AM
Yes, it is within Ext.onReady. I had some code outside Ext.onReady that probably caused that the given code didn't run, thus, the form didn't show up. It showed up after after I removed the code outside it.

However, I have tried the code after I made a Viewport, and the form doesn't show up.

First:
var viewport = new Ext.Viewport({
layout : 'border',
items : [navCol, content]
});

Then:
var fp = new Ext.form.FormPanel({
renderTo : Ext.getBody(),
width : 400,
height : 160,
title : 'Exercising textfields',
frame : true,
bodyStyle : 'padding: 6px',
labelWidth : 126,
defaultType : 'textfield', // 1
defaults : {
msgTarget : 'side', // 2
anchor : '-20'
},
items : fpItems
});

Am I doing something wrong here?

Condor
22 Mar 2010, 4:26 AM
A viewport already covers the entire browser window. Where would you render the form?

Either embed the form in the viewport using the add() method of one of it's panels or include the form in an Ext.Window so it floats over the viewport.

spor
22 Mar 2010, 4:43 AM
Alright, I have done as you suggested,

var fp = new Ext.form.FormPanel({
// renderTo : Ext.getBody(),
region : 'south', // also tried 'east'
...............

var viewport = new Ext.Viewport({
layout : 'border',
//items : [navCol, content]
items : [navCol, content, fp]

Now the form is rendered, but the the content/fields of the form doesn't show up. The only time they appear is when I have the region set to 'center'. How come?

Condor
22 Mar 2010, 4:58 AM
Just checking: A south region needs a height and an east region needs a width.

spor
22 Mar 2010, 5:02 AM
I already have height and width...

var fp = new Ext.form.FormPanel({
// renderTo : Ext.getBody(),
region : 'east',
width : 400,
height : 160,
...........

Is that correct?

Condor
22 Mar 2010, 5:15 AM
An east region shouldn't have a height, but that can't cause the fields not to be visible...