Skip to main content

<af:setPropertyListener> fails when used with <af:showPopupBehavior> for a button's action !

I've discussed a possible reason for <af:setPropertyListener> not to work on <af:popup> when used along with childCreation="deferred" in one of my previous post. In today's post, I'm again taking you back to yet another unsupported usage of <af:popup> :-). In this case, the popup triggering part looks like as shown in the following page snippet. Apparently, here the expectation is to initialize 'someVariable' before showing the popup.

 <af:commandButton text="Show Popup" id="cb6">  
 <af:setPropertyListener from="#{'something'}" to="#{pageFlowScope.someVariable}" type="action"/>  
 <af:showPopupBehavior popupId="p1"/>  

However the above fails to initialize the property before showing the popup. Why?

The reason is well documented under 'Cancels Client Events' of the <af:showPopupBehavior> tag doc.

The showPopupBehavior tag cancels the client event defined by the triggerType. Canceling the client event will prevent delivery to the server. This is significant for action events raised by command family components because the server-side action listeners will be ignored. All actionListener method bindings and associated action listeners will not be invoked when the triggerType of "action" is used.

In a nutshell the action event gets cancelled by the showPopupBehavior tag, so your property setter doesn't gets invoked. However there are a couple of workarounds...

1. Try using popupFetchListener for initializing the popup content(instead of <af:setPropertyListener> tag).
 <af:popup id="p2" contentDelivery="lazyUncached"   
     popupFetchListener="#{TestBean.popupFetchAction}" ...  

2. Try opening the popup programmatically (instead of using showPopupBehavior tag). Examples can be found under the tag doc for af:popup. You can safely use <af:setPropertyListener> to initialize properties in this approach.

3. Trigger the showPopupBehavior for 'click' instead of 'action'.
<af:showPopupBehavior popupId="p1" triggerType="click" />
Underlying theory is that 'click' and an 'action' do not cancel each other.


Nice post as usual!
Although in my opinion 1 is not a solution. Reason is if control is disabled and its triggerType="click", it will still raise the component (which in this case obviously we do not want).

Jobinesh said…
Thanks Spyros for the input,I was not aware of that. That makes me to drag the first point to the last place :)
Naresh said…
Hey thanks man.
Thanks..that help to remove the confusion.
Sunil said…
In my trial I found that triggerType should always be set to "action" if we use "popupFetchListener". And that's what we wanted. Thanks.
subbu said…
Thanks Jobinesh for the post...It helped me in the similar use case.
Girish S said…
I've created a table with max 6 columns.. Its width is fixed as 90% in CSS file. But when an action takes place like "view only 4 columns" then the extra space is visible.. I want the width of the table to be dynamic according the number of rows I select. Can you please help me with this problem..?

Popular posts from this blog

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…