I would like to describe how to refresh dynamic content available in ADF Page Template from consuming ADF Page Fragment. This is not always obvious, because physically ADF Page Template and ADF Page Fragment are two different files. However, this is possible by applying partial trigger on ADF Page Template binding tag inside ADF Page Fragment itself. This post is intended to show how to refresh ADF Page Template from ADF Page Fragment, use case about selected employee name retrieval can be implemented in different ways as well.
Sample application contains ADF Page Template with layout component, as well as with output text component to display template attribute value. This value will be changed from the consuming ADF Page Fragment - means we would need to trigger refresh in order to have it changed in ADF Page Template:
Output text gets its value from ADF Page Template attribute:
There is ADF Page Fragment, which is based on ADF Page Template and contains a button to store currently selected employee name into pageFlowScope. As you can see, there is ADF Page Template tag, but we dont have direct access to the UI component from this template - means we can't declare Partial Triggers from button:
What we can do - select af:pageTemplate tag:
Declare Partial Triggers for af:pageTemplate - its how we can refresh UI components defined in the template. Partial Triggers property points to the UI button component available in the ADF Page Fragment - its how we can refresh components in the template, from local button available in the fragment itself:
Button which triggers refresh, contains property listener, it stores selected employee name into pageFlowScope:
PageFlowScope variable is populated with selected employee last name value:
Value is propagated up to ADF Page Template and content is refreshed through PPR event raised from Set Employee button:
Sample application contains ADF Page Template with layout component, as well as with output text component to display template attribute value. This value will be changed from the consuming ADF Page Fragment - means we would need to trigger refresh in order to have it changed in ADF Page Template:
Output text gets its value from ADF Page Template attribute:
There is ADF Page Fragment, which is based on ADF Page Template and contains a button to store currently selected employee name into pageFlowScope. As you can see, there is ADF Page Template tag, but we dont have direct access to the UI component from this template - means we can't declare Partial Triggers from button:
What we can do - select af:pageTemplate tag:
Declare Partial Triggers for af:pageTemplate - its how we can refresh UI components defined in the template. Partial Triggers property points to the UI button component available in the ADF Page Fragment - its how we can refresh components in the template, from local button available in the fragment itself:
Button which triggers refresh, contains property listener, it stores selected employee name into pageFlowScope:
PageFlowScope variable is populated with selected employee last name value:
Value is propagated up to ADF Page Template and content is refreshed through PPR event raised from Set Employee button:
Download sample application - TemplateRefreshApp.zip.
Hi, thanks for this post.
ReplyDeleteI didn't know about putting partialTriggers in af:pageTemplate. Hope it will solve my issues.
But, I don't understand why you put "bindings.LastName.inputValue" into "pageFlowScope.LastName". It works even if we pass directly "bindings.LastName.inputValue" into template attribute. Passing values from bindings to template attribute directly is not recommanded?
(I ask this, because doing so, I can put partialTriggers=pc1:t1).
h0s
Hi,
ReplyDeleteNo, there is nothing like that - I prefer to pass values directly through bindings. Just in this case, I wanted to separate through pageFlowScope, in order to show that refresh works even when value is passed through pageFlowScope.
Thanks for question.
Andrejus
Hi. I'm new to ADF and what I'm looking for is "the opposite" of this post, or better how to refresh dynamic content available in ADF Page Fragment in another Fragment, as a polling. Thank you for your consideration.
ReplyDeleteMay be this will help:
ReplyDeletehttp://andrejusb.blogspot.com/2011/02/adf-region-communication-region-refresh.html
Hi,
ReplyDeleteThanks for your post. Nevertheless, i have the exact opposite need: how to refresh the content facet of a page template when some selectonechoice changes its value. Any clues?
Regards.
Hi, Andrejus
ReplyDeleteHow to get page template attribute value on template binding?
I will invoke execute with params methods and template attribute set to method param.
How to do this?
thanks