PDA

View Full Version : How to know when the checkbox of the treepanel is checked



infips00
22 Oct 2009, 4:26 AM
Hi,

I'd like to know when checkbox of a TreePanel is checked. I used the CheckChange event, but it is fired for every check is changed, and I only need to execute the code once. Is there any way to solve my problem?

Even I've tried with but it doesn't work too:


gruposKpisTreePanel.addListener(Events.OnClick,new Listener<TreePanelEvent<BaseTreePanel>>() {

public void handleEvent(TreePanelEvent<BaseTreePanel> be) {

if (be.getNode().getElement().equals(gruposKpisTreePanel.getView().getCheckElement(be.getNode()))) {
Window.alert(be.getTarget().getString());
}


// TODO Auto-generated method stub

}
});


Could anybody help me?

sven
22 Oct 2009, 4:56 AM
gruposKpisTreePanel.addListener(Events.CheckChange,new Listener<TreePanelEvent<BaseTreePanel>>() {

public void handleEvent(TreePanelEvent<BaseTreePanel> be) {

if (be.isChecked()) {
Window.alert(be.getTarget().getString());
}


// TODO Auto-generated method stub

}
});

infips00
22 Oct 2009, 5:41 AM
Hi Sven,

If I have activated this option:


gruposKpisTreePanel.setCheckStyle(CheckCascade.CHILDREN);

this event is fired for each tree node (include the children) and I need that the event was fired only once.

Thanks