Refreshing a UI field on Button click.
SanjeevChauhan Aug 21, 2013 11:40 AMI have and input text and a search icon next to in on UI. On click on search icon I show a popup and on click of OK button on popup I set a value in pageFlowScope and tries to refresh input text. Input text value is same pageFlowScope variable so I was expecting it to show value in input text. But its not happening.
jsff code
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:f="http://java.sun.com/jsf/core">
<af:panelLabelAndMessage label="Label 1" id="plam1">
<af:inputText id="it1" value="#{pageFlowScope.pSecureByAdminRole}"/>
<f:facet name="end">
<af:commandImageLink id="cil1" icon="/adf/webcenter/find_ena.png" partialSubmit="true" actionListener="#{backingBeanScope.RelationshipBean.launchSearchRolePopup}" immediate="true"/>
</f:facet>
</af:panelLabelAndMessage>
<af:popup id="p1" binding="#{backingBeanScope.RelationshipBean.searchRolePopup}">
<af:dialog id="d1" type="none">
<f:facet name="buttonBar">
<af:commandButton text="Ok" id="cb1" actionListener="#{backingBeanScope.RelationshipBean.handleRoleSearchOK}" partialSubmit="true"/>
</f:facet>
</af:dialog>
</af:popup>
</jsp:root>
Bean code
public void launchSearchRolePopup(ActionEvent actionEvent) {
ADFUtils.showPopup(this.getSearchRolePopup(), null, null, null);
}
public void handleRoleSearchOK(ActionEvent actionEvent){
ADFUtils.getPageFlowScope().put("pSecureByAdminRole", "TEST");
this.getSearchRolePopup().hide();
ADFUtils.refreshUI(this.getSecureByAdminRoleOnNewDocument());
}
ADFUtil Code:
public static void showPopup(RichPopup popup,UIComponent alignComponent,RichPopup.PopupHints.AlignTypes alignType,RichPopup.PopupHints additionalHints ){
FacesContext context = FacesContext.getCurrentInstance();
if(additionalHints == null)
additionalHints = new RichPopup.PopupHints();
String alignId = null;
if(alignComponent != null){
alignId = alignComponent.getClientId(context);
additionalHints.add(RichPopup.PopupHints.HintTypes.HINT_ALIGN_ID, alignId);
}
if(alignType != null){
additionalHints.add(RichPopup.PopupHints.HintTypes.HINT_ALIGN, alignType);
}
popup.show(additionalHints);
}
public static void refreshUI(UIComponent uiComponent){
AdfFacesContext adfctx = AdfFacesContext.getCurrentInstance();
adfctx.addPartialTarget(uiComponent);
}
Input text does not show new value (TEST). If I just click on browser refresh icon, it starts showing TEST. By that way it looks like refresh issue only.
I tried setting partial trigger of input-text to refer to OK button of popup but no success.
Thanks
Sanjeev.