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

emmanuel dufour (JIRA) jira-events at lists.jboss.org
Fri Sep 14 08:22: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:20 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 closes right away because it renders 1 pixel off the mouse pointer and that it auto closes as it should when the mouse is off the menu

to fix this offset is added to the contextmenu tag by adding 
{code}
verticalOffset="-1" horizontalOffset="-1"
{code}
                
      was (Author: emmanueldufour):
    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 - my guess is that the menu renders 1 pixel off the mouse pointer and that it auto closes as it should when the mouse is off the menu

                  
> 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