PDA

View Full Version : accordion init component while collapsed



umit
29 Mar 2010, 12:32 AM
Hi everyone!

I have following problem:
I have an accordion layout with 2 panels.
the first panel is for choosing an element and if you doubleclick the detail will be displayed in the second panel.

However there is one problem:
The elements of panel2 seems not to be initialised, so i get an "is undefined" error.

When i open panel2 and close it, i dont have the problem.
However opening and closing it looks creepy.

Is there a way to initialise the elements while it is collapsed?
or is there something like a callback in mainPanel.layout.setActiveItem(panel1)...callback:initPanel2() ?

ishobr
29 Mar 2010, 12:49 AM
Please post your code. We can't imagine how your code look like.

umit
29 Mar 2010, 1:10 AM
//the Panel with Accrodion
new Ext.FormPanel({
labelAlign: 'top',
layout:"accordion",
layoutConfig: {
// layout-specific configs go here
titleCollapse: false,
animate: true,
activeOnTop: true
},
frame: true,
closable:true,
title: 'Datenabruf',
bodyStyle: 'padding: 5px 5px 0',
id: 'Form',
items: [panel1,panel2]//note: panel1 and panel2 are both collasped:true
});
......
panel1=new Ext.grid.GridPanel({
store: store,
region:'center',
height:400,
autoScroll:true,
listeners:{
"rowdblclick":function(grid, rowIndex) {
var record = grid.store.getAt(rowIndex);

Ext.ComponentMgr.get("Form").layout.setActiveItem(panel2);
store.load({"callback": loadPanel2(record))}
}
}});

function loadPanel2(record){
Ext.ComponentMgr.get("panel2Text").setValue(record.get("NAME"));
}


If i open and close panel2 it works.
But when i let panel2 closed then it says Ext.ComponentMgr.get("panel2Text") is undefined

umit
29 Mar 2010, 1:16 AM
ok i identified, that its not the panel2Text but its panel2RadioButton

The Radio Group is initialised but not the Radio button itself...