PDA

View Full Version : [2.0b1] Formpanel within Window



seymores
17 Oct 2007, 9:32 PM
I have a grid which is created dynamically and on "rowdblclick" will opens a floating window with an embedded FormPanel.
The form contains simmply with 3 textfields and 1 textarea.

The problem is the textfield or the textarea will be out of size. Please see the attached screenshots.
If I close and re-open the grid and do the rowdblclick, the window with the form might come out right. Most of the time, the size is out of the specified range.

The textfields/textarea just cannot get the size correct.

I tried to first create the window and then add the form to the window and call a doLayout() from the window. None works.

I think this is a bug.

I attached my code below -- looks normal though. I also attached the screenshots of the problem in IE and FF2.

I'm going crazy with this -- help! :((




var form = new Ext.FormPanel({
labelWidth:70,
frame:true,
url:'/app/dashboard/form',
bodyStyle:'padding:5px 5px 0',
defaultType:'textfield',
defaults: {width: 180},
autoWidth:true,
autoHeight:true,
items: [{
fieldLabel:'Name',
name: 'name'
},{
fieldLabel:'Value',
name:'value'
},{
fieldLabel:'Type',
name:'type'
},{
xtype:'textarea',
fieldLabel:'Description',
name:'description'
}]
});

form.on('success', function(form, action) {
popupwin.hide();
});

var popupwin = new Ext.Window({
width:350,
height:260,
closeAction:'hide',
plain:true,
items: form,
resizable:false,
buttons: [{
text:'Save',
handler: function(){
form.form.submit({
success: function(rst, req) {
Ext.Msg.alert('Data saved', 'Data is saved');
form.form.reset();
popupwin.hide();
},
failure: function(rst, req) {
Ext.Msg.alert('Save data failed', 'Data is NOT saved');
form.form.reset();
popupwin.hide();
}
});
}
}, {
text:'Close',
handler: function(){
popupwin.hide();
}
}],
title:'${data.id}'
});

grid.on('rowcontextmenu', function(grid, rowIndex, e) {
e.stopEvent();
contextMenu.showAt(e.getXY());
});

grid.on('rowdblclick', function(grid, rowIndex, e) {
var row = grid.getSelectionModel().getSelected();
popupwin.show(this);
});

});

seymores
17 Oct 2007, 10:23 PM
Further showed that the same code works fine in a test html page. That narrows down to the possibility of the problem happen if it's in a grid panel.

Is there any methods to call the window or the form to realign the layout before being displayed?

I tried form.doLayout() and popwin.doLayout() but to no avail.