[richfaces-issues] [JBoss JIRA] (RF-12488) detached contextmenu menu fails

emmanuel dufour (JIRA) jira-events at lists.jboss.org
Fri Sep 14 08:05:32 EDT 2012


    [ https://issues.jboss.org/browse/RF-12488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718633#comment-12718633 ] 

emmanuel dufour edited comment on RF-12488 at 9/14/12 8:04 AM:
---------------------------------------------------------------

There is a partial workaround :
in case of the button the context menu can be called by passing the event as parameter instead of using componentcontrol ex:
{code}
 	<h:button value="detached menu error" onclick="#{rich:component('contextMenu2')}.show(event);return false;">

	</h:button>
{code}

plus to avoid javascript error I suggest updating line 52 of contextmenu.js by adding a test for "this.target"
such as :

{code}
if (this.target){
                    var parent = rf.$(this.target);
                    if (parent && parent.contextMenuShow) {
                        parent.contextMenuShow(this, e);
                    }
}
{code}

With all that done, under myfaces, the context menu shows at the mouse pointer but then inexplicably closes right away

                
      was (Author: emmanueldufour):
    There is a partial workaround :
in case of the button the context menu can be called like by passing the event as parameter  instead of using component control such as :
{code:xml}
 	<h:button value="detached menu error" onclick="#{rich:component('contextMenu2')}.show(event,this);return false;">

	</h:button>
{code:xml}

plus to avoid javascript error I suggest updating line 52 of contextmenu.js by adding a test for "this.target"
such as :

{code}
if (this.target){
                    var parent = rf.$(this.target);
                    if (parent && parent.contextMenuShow) {
                        parent.contextMenuShow(this, e);
                    }
}
{code}

With all that done, under myfaces, the context menu shows at the mouse pointer but then inexplicable closes right away

                  
> detached contextmenu menu fails
> -------------------------------
>
>                 Key: RF-12488
>                 URL: https://issues.jboss.org/browse/RF-12488
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component
>    Affects Versions: 4.2.2.Final
>         Environment: fails both on server tomee 1.1 (myfaces 2.1.8) and server Glassfish 3.x (mojarra 2.1)
>            Reporter: emmanuel dufour
>
> Context menu can be used "attached" or not, the code below creates 2 buttons, the 1rt one "attached" works as expected but the 2nd one "detached" doesnt. The context menu appears in a wrong place (myfaces) or not at all (mojarra).
> {code:xml}
> <h:form >
> 	
> 	<h:button id="ass" value="attached menu ok" onclick="return false;">
> 	</h:button>
> 	
> 	<rich:contextMenu id="contextMenu" target="ass" showEvent="click">
> 		<rich:menuItem label="Edit this" />
> 	</rich:contextMenu>
> <br/><br/><br/>
>  	<h:button value="detached menu error" onclick="return false;">
> <rich:componentControl event="click"  target="contextMenu2" operation="show"/>
> 	</h:button>
> 	
> 	<rich:contextMenu  mode="client" attached="false"   id="contextMenu2" >
> 		<rich:menuItem label="Edit this" />
> 	</rich:contextMenu>
> </h:form>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list