In ADF we usually use the pop-up for entering the data. Sometimes we don't want to save the data which we entered in the pop-up form, user may press the Esc button or click on cancel, but still the data will be added to the corresponding VO. So how to clear the data or row which is added in that VO.
In the below example we will see how to clear the data form the pop-up.
In the PopupFetchListner call the managed bean to create new row in the VO.
public void addNewItem(PopupFetchEvent popupFetchEvent) {
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("CreateInsert");
operationBinding.execute();
}
The popup will be appeared with the empty fields. and you can add the data to the popup.
Now on click of esc button on keyboard, or cancel button on in the popup, this managed bean will be called and the VO cache gets cleared.
NOTE: Make sure that the popup "contentDelivery" property is set to lazyUncashed. if you make it "immediate" the managed method wont be called and VO cache wont get cleared.
In the below example we will see how to clear the data form the pop-up.
In the PopupFetchListner call the managed bean to create new row in the VO.
public void addNewItem(PopupFetchEvent popupFetchEvent) {
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("CreateInsert");
operationBinding.execute();
}
The popup will be appeared with the empty fields. and you can add the data to the popup.
When you click on the cancel button, you want to clear the data which you have entered.
To do so, you have to call the managed bean trough the popupCanceledListener property of the popup.
To clear the popup, get the iterator through th BindingContext, and DCBindingIterator classes as show in below code snippet.
public void clearPopUp(PopupCanceledEvent popupCanceledEvent) {
// Add event code here...
DCBindingContainer bindings =(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding orderItemIterator = bindings.findIteratorBinding("OrderItemsVO2Iterator");
ViewObject viewObject = orderItemIterator.getViewObject();
viewObject.clearCache();
viewObject.executeQuery();
System.out.println("Cashe is cleared");
}
Now on click of esc button on keyboard, or cancel button on in the popup, this managed bean will be called and the VO cache gets cleared.
NOTE: Make sure that the popup "contentDelivery" property is set to lazyUncashed. if you make it "immediate" the managed method wont be called and VO cache wont get cleared.