PDA

View Full Version : Accordion collapses when clicking content panel toolbar button



DanWhite
17 Sep 2010, 2:43 AM
Hi, I have an accordion layout where each content panel has a tool button to reload its data. The accordion is set to expand/collapse if I click anywhere on the heading panel.

When I click the reload button it executes the associated action but also collapses the content panel, meaning I have to re-expand the panel to see the results of the action.

sven
17 Sep 2010, 2:46 AM
Please read the bugforum guidelines for posting in the bugforum. I moved this out now, as this is not a bug. AccordionLayout has a property called titleCollapse, same as ContentPanel. This defaulst to true for AccordionLayout. You need to set it to false.

DanWhite
17 Sep 2010, 2:49 AM
It is a bug though - the click was on a toolbar button and not the title itself.

sven
17 Sep 2010, 2:53 AM
It was on a toolbar button, or on a tool item? A tool item is part of the header, and if that is set to true, the hole header will make it collapsing/expanding. Take a look at the javadoc for ContentPanel.setTitleCollapse

DanWhite
17 Sep 2010, 3:57 AM
So even if I add a tool to the header component you would expect that clicking that tool would do both things: execute the tool's action AND collapse the title bar?

sven
17 Sep 2010, 4:06 AM
That is how it was implement long ago. We cannot change this in any minor version as it would be a braking change. You will need to set titlecollapse to false.We can relook into this for GXT3.

For now, add an Events.OnClick listener to your ToolItem and cancel bubbling.

DanWhite
17 Sep 2010, 4:18 AM
OK cool. Thanks for the advice, it works!