Thursday, July 9, 2015

Programatically Calling Hidden Button Action

If you want to call a hidden button action from another button action/event use below code

private void navigateByQueueAction() {
   FacesContext fctx = FacesContext.getCurrentInstance();
   UIViewRoot root = fctx.getViewRoot();
   //client Id of button includes naming container like id of region. 
   RichCommandButton button = 
           (RichCommandButton) root.findComponent("r1:cb3");
   ActionEvent actionEvent = new ActionEvent(button);
   actionEvent.queue();
}