-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I have a Groupbox, which has a checkbox, some labels and an icon in caption. I want to make the Groupbox open/close only when user clicks the icon in the cation. The icon works fine.
However, whenever I check/uncheck the checkbox, the groupbox is also open/close. I have no idea how this happens. Can somebody help?
Following is my code:
<groupbox id="testGB" open="@{data.panelOpen}">
<caption>
<checkbox onCheck="controller.checkMember(self);" checked="@{data.selected}" />
<label value="test" />
<image src="collapse_plus.png" onClick="controller.togglePanel(self);" />
</caption>
<div id="gbPanel">
...
</div>
</groupbox>
In my controller:
public void togglePanel(final Component tbtn) {
Groupbox gb = getParentComponent(tbtn, Groupbox.class);
data.setPanelOpen(!data.getPanelOpen());
gb.invalidate();
binder.loadComponent(gb);
}
public void checkMember(final Component tbtn) {
//do something else
}
bellow my code sample:
public class Data{
private Boolean panelOpen = false;
public Boolean getPanelOpen() { return panelOpen; }
public void setPanelOpen(Boolean panelOpen) { this.panelOpen = panelOpen; } }
I actually tried to remove all code from checkMember()
method and the Groupbox
still gets open/close
when the checkbox
is checked/unchecked
.
Please help!!!
Thank You!
why this method you use.
public void togglePanel(final Component tbtn) {
Groupbox gb = getParentComponent(tbtn, Groupbox.class);
data.setPanelOpen(!data.getPanelOpen());
gb.invalidate();
binder.loadComponent(gb);
}
if you want to open close groupbox
on click caption
and image
no need to write any new code by default it will work.
you just remove this method and remove this code also.
open="@{data.panelOpen}"
try this code
<groupbox id="testGB">
<caption>
<checkbox />
<label value="test" />
<image src="1.jpeg" />
</caption>
<div id="gbPanel">...</div>
</groupbox>
Asked: 2014-01-22 22:33:08 +0800
Seen: 40 times
Last updated: Jan 23 '14
can you provide the "data" class to?
chillworld ( 2014-01-23 07:15:42 +0800 )editpublic class Data{
private Boolean panelOpen = false;
public Boolean getPanelOpen() { return panelOpen; }
paula ( 2014-01-23 16:22:19 +0800 )edit