Skip to main content

Why do you see a duplicate af:commandToolbarButton after partial page refresh?

This is a very widely observed issue if you have partialTriggers set for child components of <af:toolbar>.
 <af:toolbar>  
 <af:commandToolbarButton ... partialTriggers="someComp"/>  
 </af:toolbar>  

What goes wrong here?

Well, please see the tag documentation for <af:toolbar> . I'm copying the relevant content for your reference.

Updating through PartialTriggers

Note that if a toolbar child component is going to be updated through partial page rendering, you need to update the toolbar as well. You do this by adding the child components id to the toolbar's partialTriggers attribute. This way the toolbar can appropriately manage its children in respect to sizing and placement in overflow. Also note that many input components also update themselves through partial page rendering. If you include an input component (or quickQuery) on a toolbar, you should include that child's id in the toolbar's partialTriggers attribute so that the toolbar also updates when the input component is replaced. Because this partialTrigger will cause overflow to close during the toolbar ppr, toolbar child components that update themselves via ppr outside of a submit (like InputComboboxLOV) will work better when not in overflow.

In a nutshell, if you change the above tag snippet to refresh the af:toolbar (instead of child elements) as shown below, issue will be solved and you can see the partial page refresh works for <af:commandToolbarButton> without any side effects.

 <af:toolbar partialTriggers="someComp">  
 <af:commandToolbarButton ... />  
 </af:toolbar>  

Comments

Ravi said…
Jobinesh,

Nice post!!

I have similar issue in my code. But I see the Button overflow issue first time on page load. On page load there is no way partialTrigger gets executed.

How can I stop button overflow from toolbar on page load?

Thanks
Ravi

Popular posts from this blog

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…