For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.
Hello,
You can try to use a setPropertyListener on poupFetch and store the value in view scope.
<af:setPropertyListener from="#{node.label}" to="#{viewScope.selectedNodeLabel}" type="popupFetch"/>
and
<af:commandMenuItem text="#{viewScope.selectedNodeLabel}"/>
If you are going to get more values store the rowData in a bean and retrieve the value that you want.
also remember to use contentDelivery="lazyUncached" in your popup.
The scope where you store the value has to be at least viewScope.
regards,
Ruben.
Thanks for your answer.
Unfortunately, I have an error when using popupFetch type:
javax.faces.view.facelets.FaceletException: ADF_FACES-60069:Aucune information methodData n''est disponible pour le type popupFetch.
at oracle.adfinternal.view.faces.facelets.rich.SetPropertyListenerHandler.apply(SetPropertyListenerHandler.java:123)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:195)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
When I use different type, it does not work (for example “focus” or “selection”).
can you share your code?
JDev version?
My code is a little bit different from the simplified example I gave you (node.DeviceType is data I want to display in my MenuItem):
<af:tree value="#{bindings.TreeViewsEOView1.treeModel}" var="node"
rendered="#{MainTreeBean.tree_is_rendered}"
rowSelection="single" id="t1"
focusListener="#{MainTreeBean.treeFocusListener}"
rowDisclosureListener="#{MainTreeBean.treeRowDisclosureListener}"
expandAllEnabled="false" displayRow="selected"
selectionListener="#{MainTreeBean.treeSelectionListener}">
<f:attribute name="devType" value="#{node.DeviceType}"/>
<af:setPropertyListener from="#{node.DeviceType}"
to="#{viewScope.selectedNodeDeviceType}"
type="popupFetch"/>
<f:facet name="nodeStamp">
<af:outputText value="#{node.TreeViewName}#{node.DeviceExternalId}"
id="nodeLabel"/>
<af:outputText value="(#{node.CompanyId}#{node.DeviceType})"
id="nodeDebug"/>
<!TODO Remove when finished debugging>
</f:facet>
<f:facet name="contextMenu">
<af:popup id="RemoteTreePopup" childCreation="deferred"
autoCancel="disabled">
<af:menu text="menu 1" id="m1">
<af:iterator id="i2"
value="#{bindings.CtxMenuItemEOView1.collectionModel}"
var="rowy">
<af:commandMenuItem text="#{vcBundle[rowy.MenuItemId]}(#{rowy.DeviceType}/#{viewScope.selectedNodeDeviceType})[#{rowy.Rendered}]"
setPropertyListener must go inside the popup.
<af:popup id="RemoteTreePopup" childCreation="deferred" autoCancel="disabled"> <af:setPropertyListener from="#{node.DeviceType}" to="#{viewScope.selectedNodeDeviceType}" type="popupFetch"/>
<af:popup id="RemoteTreePopup" childCreation="deferred" autoCancel="disabled">
<af:setPropertyListener from="#{node.DeviceType}" to="#{viewScope.selectedNodeDeviceType}" type="popupFetch"/>
Also remember to use contentDelivery="lazyUncached" in the popup
It seems to work better. The only matter I still have is that I have to right-click twice on a node to make contextual menu appearing, but maybe that's another issue...
I didn't have that problem.
In blog post there is a link to my github repository to download the example: rsantrod's Blog: ADF: af:tree custom context menu using selected row values
I've reproduced the problem with a fresh download of your github project.
When doing right-click on a node, sometimes does not work (nothing appears, have to double-right click or label can match with previous clicked node), depending on the level of the tree you right-click on. Maybe iterator does not always refresh correctly.
I have a video shot and logs to share if necessary.
Maybe we have to create another post about that or document it into your github project as an issue?
Tested on FF40.0.3 and IE11.0.9600, Windows 7.
Weblogic integrated server in JDev Studio Edition Version 12.1.3.0.0
I can reproduce "When doing right-click on a node, sometimes does not work (nothing appears, have to double-right click or label can match with previous clicked node), depending on the level of the tree you right-click on. Maybe iterator does not always refresh correctly."
It is a strange behavior. You can open a new post if you want.
Try with contextMenuSelect="false" property in your tree.
It improves a lot to me.