PDA

View Full Version : Problem with panel.add(Component) in RowExpander



magnum99
13 Apr 2009, 11:13 PM
Hello everybody!

I've a problem with the method add(). My FormPanel doesn't render. I'm using RowExpanderPlugin with Grids. When I expand some row, a FormPanel should be rendered with use of LayoutManager.
so here's my Code:


function expandGrid(record,index) {
var formPanel1 = new Ext.FormPanel({
id: 'id',
items: [ {title: "title1"} ]
});
var panel = new Ext.Panel({
id:'main-panel'+index,
baseCls:'x-plain',
renderTo: Ext.getBody(),
layout:'table',
layoutConfig: {columns:2},
// applied to child components
defaults: {frame:true },
renderTo: 'remData'+index,
}
now when I use panel.add() it doesn't work:

panel.add(formPanel1);
panel.doLayout();but when I define this static:

var panel = new Ext.Panel({
id:'main-panel'+index,
baseCls:'x-plain',
renderTo: Ext.getBody(),
layout:'table',
layoutConfig: {columns:2},
// applied to child components
defaults: {frame:true },
renderTo: 'remData'+index,
items:[
personPanel
]
});then it works, but I don't want to use this solution but the first one with .add()
could anyone help me and say how should it be solved ?

thank you for all your answers