Friday, January 20, 2012

JSF, ICEfaces and resetting component values

I just spent some time trying to figure out how to reset the value of the HtmlSelectOneMenu when cancel button is clicked using ICEfaces. The solution is to add actionListener to your ice:commandButton (in this case Cancel) and to find any component that you want to reset. My reset code was:
...
public void resetData(ActionEvent ae){
    ((com.icesoft.faces.component.ext.HtmlInputText) ae.getComponent().getParent().getParent().findComponent("dateComponent")).setValue(null);
    ((com.icesoft.faces.component.ext.HtmlSelectOneMenu) ae.getComponent().getParent().getParent().findComponent("selectComponent")).resetValue();
}
...

No comments:

Post a Comment