rich:menuItem + rich:popupPanel : How to ?
ikos2201 Aug 6, 2013 12:06 PMHi !
I have found out one interesting feature, I'm not sure that this is a bug .
Let's look at two pieces of code :
<a4j:commandLink actionListener="#{ someBean.someMethod() }" render="somePanel_Id" oncomplete="#{rich:component('myPopupPanel_Id')}.show(); return false;">
<h:outputText value=" Click Me ! ) " />
</a4j:commandLink>
VS.
<rich:dropDownMenu>
<rich:menuItem >
<a4j:commandLink actionListener="#{ someBean.someMethod() }" render="somePanel_Id" oncomplete="#{rich:component('myPopupPanel_Id')}.show(); return false;" >
<h:outputText value=" Click Me ! ) " />
</a4j:commandLink>
</rich:menuItem>
</rich:dropDownMenu>
In the first case, I know that I'll have the next sequence of actions :
someMethod() invocation (I can init some resources in that method, for instance) --> after that --> My_PopupPanel will be opened !
But in the second case, my actionListener will be invoked and that's all ))) or I'll get some error if I change submitMode for rich:menuItem .
I thought that in both cases we will have html output - <a href="" ....> tag (because either of these components have actoinListener , action, oncomplete, etc., so I supposed these components should have similar behaviour), but
I was wrong. It seems like their behaviours are different. So I don't know how to call popup window (rich:popupPanel) from rich:dropDownMenu = )
I have created the following workaround that works for me :
<a4j:jsFunction name="openMyPopupFunc" actionListener="#{ someBean.someMethod() }"
render="some_Component_Id" oncomplete="#{rich:component('myPopup_Id')}.show(); return false;" />
then
<rich:menuItem submitMode="none" onclick="openMyPopupFunc(); return false;">
<h:outputText value=" Click Me !) " />
</rich:menuItem>
And the question is = ) How else can I open rich:PopupPanel from rich:dropDownMenu ? Is there any legal ) way or another workarounds ?