Sample UseCase: Suppose the popup has input form fields to enter data with say OK and Cancel buttons, and when the user enters data and clicks on 'Cancel' button, we need to close the popup and reset all values entered in the popup's fields. If you don't reset the values, if you invoke the same popup again, it'll show the same previously entered values in the form which is unwanted. So, how to show the popup without the previous values?
Solution:
1. Set popup's 'contentDelivery' property to 'lazyUncached'. Setting this property won't cache the data entered and won't restore the previously entered values. This is highly recommended to set contentDelivery="lazyUncached" for better performance as the popup will be loaded only on invocation but not at the time of page loading.
1 <af:popup id="popup1"
2 binding="#{pageFlowScope.ClassSectionCreateBean.cancelWarningPopup}"
3 contentDelivery="lazyUncached">
2. If the step1 doesn't work, drop af:resetActionListener as a sub-element to 'Cancel' button in the popup. ResetActionListener will reset the form fields in the popup. We can also call ResetActionListener programmatically in an actionlistener method as follows using Oracle's internal API.
1 public void saveSections(ActionEvent ae) {
2 //Your logic here
3 ResetActionListener ral = new ResetActionListener();
4 ral.processAction(ae);
5 }
But, using internal API in the code is not encouraged. There is public API to achieve the same using the below code.
1 UIComponent comp = actionEvent.getComponent();
2 oracle.adf.view.rich.util.ResetUtils.reset(comp);
But, this Public API is not yet available in the latest publicly available Jdeveloper available and it'll be available in the upcoming versions. Until then, we need to go ahead using internal API only as shown in step2.
Above solutions might not work....
3. solution works for me
We need to write below code at cancel button before hide the popup.
Row r1 = hdrVo.getCurrentRow();//r1.refresh(oracle.jbo.Row.REFRESH_UNDO_CHANGES | Row.REFRESH_FORGET_NEW_ROWS);
r1.refresh(r1.REFRESH_UNDO_CHANGES | r1.REFRESH_WITH_DB_FORGET_CHANGES);
No comments:
Post a Comment