Question

I am trying to set focus to a component in Icefaces 1.8.2, but it doesn't work probably because of the component not being rendered at the time of the method call. Any ideas?

JavascriptContext.addJavascriptCall(getContext(),
                "document.getElementById('"+ getClientId(component) + "').focus();");
Était-ce utile?

La solution

This works, I messed it up somewhere previously..

JavascriptContext.applicationFocus(getContext(), getClientId(component));


public static String getClientId(UIComponent component) {
    return component.getClientId(getContext());
}

public static FacesContext getContext() {
    return FacesContext.getCurrentInstance();
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top