PDA

View Full Version : ContentPanel setCollapsible(true) issue



pourmo
15 Jul 2009, 1:21 AM
Hi

I have come a cross an issue which I think it may be a bug and it is to do with ContentPanel inside a splitter.

I have created a ContentPanel (A1) which has another contentPanel (A2) as a top component with setCollapsible(true). I then add another panel to panel (A1) using the normal add method and then add it to a bottom component of a horizontal splitter. When the header panel is collapsed the bottom component does not automatically resize until I move the splitter up or down. below is the code for the generation of Panel (A1) and (A2).



private ContentPanel panel;
private ContentPanel createBasePanel(){
panel = new ContentPanel();
panel.setHeaderVisible(false);
panel.setLayout(new FitLayout());
panel.setBodyBorder(false);
panel.setBorders(false);
panel.setTopComponent(createHeaderPanel());
panel.setScrollMode(Scroll.AUTO);
panel.add(htmlBody);
return panel;
}

private ContentPanel createHeaderPanel(){
panelHeader = new ContentPanel();
panelHeader.setHeaderVisible(true);
panelHeader.setHeading("");
panelHeader.setCollapsible(true);
panelHeader.setBodyBorder(false);
panelHeader.setBorders(false);
panelHeader.setLayout(new FitLayout());
panelHeader.add(panelDocumentHeader);
panelHeader.setHeight(80);
return panelHeader;
}


Thanks
Mo

sven
15 Jul 2009, 1:58 AM
Moving this to the help forum as this is no bug. Panel do not auto adjust if you just collapse something. You should also post a comlete testcase so that user understand what you are trying to do.

pourmo
15 Jul 2009, 8:38 AM
Hi Sven

I disagree, I gave an explanation of the problem and I also included code on how the panels were created, the reason I posted this as a bug is also stated "component does not automatically resize until I move the splitter up or down" Why would the inner component re-size automatically when the splitter is moved.

I will post the issue again according to this thread http://www.extjs.com/forum/showthread.php?t=70546

sven
15 Jul 2009, 8:53 AM
You should post your code in this thread and not open a new bugreport.

You add something as topcomponent and than collapse it and the rest does not automatically regain the new space. A ContentPanel is not designed to handle this automatically. You have to implement this functionally.

If you move the splitter (i guess from a BorderLayout) than the ContentPanel gets relayouted and caculates for the new ( now smaller height) if the inner (now collapsed) Contentpanel). This is really no bug. All is working as expected.

The_Jackal
16 Jul 2009, 5:30 PM
Two comments:
- If you include an full example that includes an onModuleLoad() then we can all run it and see if we can help.

- Try calling layout() on the parent container (or a layout in a DeferredCommand) after you've added then panels. Moving the split bar is effectively doing this manually. You will just need to find the right place to call layout().