Programmatic PPR on af:outputText / af:outputFormatted
Partial page rendering (PPR) allows small areas of a page to be refreshed without the need to redraw the entire page. I had a scenario where an af:outputText component needs to be refreshed programmatically. The <af:outputText> tag looks like as ashown below.
To PPR the outputText component, tried calling the following API from backing bean method.
AdfFacesContext.getCurrentInstance().addPartialTarget(outputTextComp);
Unfortunately this didn't help me out. Also, noticed the following warning message in the server console at runtime.
Why does Programmatic PPR fail for <af:outputText>?
In an attempt to reduce content size of the web page, framework tries optimize the handling of auto-generated ids for af:outputText / af:outputFormatted components. This mean that, id will be generated only if it's really required by the client. The same 'id suppression' optimization is applicable even if you have id set explicitly for the component. One scenario where the id required at client side is during the partial page rendering of components. So adding the outputText as a 'partial target' declaratively will result in client side id generation. But in the above use case outputText needs to be updated programmatically, so there doesn't exist any explicit partialTriggers set declaratively.
Solution
Having said that, however there exist two possible solutions to work around this scenario.
1. Set clientComponent="true" for af:outputText which would generate the required client side id.
2. Disable 'id suppression' optimization at application level by adding the following context parameter in web.xml
The oracle.adf.view.rich.SUPPRESS_IDS parameter can take two values
auto : Components can suppress auto generated IDs, but explicitly set ID needs to be honored.
explicit : This is the default value for oracle.adf.view.rich.SUPPRESS_IDS parameter. In this case both auto generated IDs and explicitly set IDs would get suppressed
<af:outputText id="op1" value="#{myBean.someValue}" />
To PPR the outputText component, tried calling the following API from backing bean method.
AdfFacesContext.getCurrentInstance().addPartialTarget(outputTextComp);
Unfortunately this didn't help me out. Also, noticed the following warning message in the server console at runtime.
oracle.adfinternal.view.faces.renderkit.rich.PprResponseWriter$PPRTag finishFurther investigation on the above issue revealed some interesting points. Let me try summarizing them below.
WARNING: no PPR-capable ID found for elements of: RichOutputText[UIXFacesBeanImpl, id=op1]
Why does Programmatic PPR fail for <af:outputText>?
In an attempt to reduce content size of the web page, framework tries optimize the handling of auto-generated ids for af:outputText / af:outputFormatted components. This mean that, id will be generated only if it's really required by the client. The same 'id suppression' optimization is applicable even if you have id set explicitly for the component. One scenario where the id required at client side is during the partial page rendering of components. So adding the outputText as a 'partial target' declaratively will result in client side id generation. But in the above use case outputText needs to be updated programmatically, so there doesn't exist any explicit partialTriggers set declaratively.
Solution
Having said that, however there exist two possible solutions to work around this scenario.
1. Set clientComponent="true" for af:outputText which would generate the required client side id.
<af:outputText id="op1" clientComponent="true" value="#{myBean.someValue}" />
2. Disable 'id suppression' optimization at application level by adding the following context parameter in web.xml
<context-param>
<param-name>
oracle.adf.view.rich.SUPPRESS_IDS
</param-name>
<param-value>auto</param-value>
</context-param>
The oracle.adf.view.rich.SUPPRESS_IDS parameter can take two values
auto : Components can suppress auto generated IDs, but explicitly set ID needs to be honored.
explicit : This is the default value for oracle.adf.view.rich.SUPPRESS_IDS parameter. In this case both auto generated IDs and explicitly set IDs would get suppressed
Thanks, you help me a lot.
ReplyDeleteI had the same problem !
Yiannis
Thanks Jobinesh... helped me a lot
ReplyDeleteThanks, that was a nice tip.
ReplyDeleteseriously it saved lot of time
ReplyDeleteThk a lot, this helped me a lot.
ReplyDelete