In Page:
[h:commandButton]
[a4j:support id="refreshBtnAjax" event="onclick"
actionListener="#{Controller.clearData}"
reRender="panelGroupToRefresh" immediate="true"/]
Re-Render
[/h:commandButton]
In Controller/ Backing Bean:
Find the component in the page that needs to be re-rendered and clear it from the component tree so that, it could be rebuilt.
public void clearData(final ActionEvent event){
Place your business logic here
final UIComponent component =
FacesContext.getCurrentInstance().getViewRoot()
.findComponent("form:panelGroupToRefresh");
if (component != null) {
component.getChildren().clear();
}
}
This helps to re-render or refresh the data immediately when we press the button or refresh data at regular interval of time, which ever is preferred.
No comments:
Post a Comment