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();");
Was it helpful?

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();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top