2 Replies Latest reply on May 19, 2012 4:59 AM by vanjalee

    contextMenu hides on click?

    vanjalee

      Hi guys,

       

      we have a pretty huge jboss seam application which runs on jboss 5.1 server. We use jsf and all the nicest features of RichFaces and a4j libraries...

      I folowed the tutorial at http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=contextMenu to create the menus

      in our views, but no matter what I do, the result is not the same as on the showcase.

      Click outside the menu doesn't close it. If I go back to menu and just make an mouseover event, it dissapears normaly.

      Is there a way to fix this behaviour?

       

      Best Regards,

      Lee

        • 1. Re: contextMenu hides on click?
          bleathem

          What version of RichFaces are you using? Can you post some simple working sample code?

          • 2. Re: contextMenu hides on click?
            vanjalee

            Thank you for answering.

            Since the whole thing is almost 4 years old already, and huge, I think there are still places in code which use RichFaces 3. I was googling that problem and found out that it was a well-known bug in previous versions. Is that problem already solved in 4.2.2 ?

            Hier is some sample code...

             

            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

                                         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                xmlns:s="http://jboss.com/products/seam/taglib"

                xmlns:ui="http://java.sun.com/jsf/facelets"

                xmlns:f="http://java.sun.com/jsf/core"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:rich="http://richfaces.org/rich"

                xmlns:a="https://ajax4jsf.dev.java.net/ajax"

                xmlns:c="http://java.sun.com/jstl/core">

             

            ...

             

            <h:form id="menuForm">

                    <rich:contextMenu attached="false" mode="client" showEvent="click" id="tdMenu">

                        <rich:menuGroup value="#{messages['datagroup.change']}" rendered="#{viewTrialDataMenu.selectedTd.trialform.groupable}">

                            <rich:menuItem value="#{messages['label.defaultgroup']}"

                                submitMode="none" icon="../graphics/icon/ok.png"

                                rendered="#{viewTrialDataMenu.selectedTd.dataGroup eq null}"/>

                            <c:forEach items="#{ViewTrialData.dataGroupsWithValidNames}" var="_dg">

                                <rich:menuItem value="'#{_dg.name}'"

                                    action="#{ViewTrialData.changeDg(viewTrialDataMenu.selectedTd, _dg)}"

                                    reRender="dataGroupsOutput, defaultGroupTable"

                                    status="globalStatus" submitMode="#{viewTrialDataMenu.selectedTd.dataGroup eq _dg ? 'none' : 'ajax'}"

                                    icon="#{viewTrialDataMenu.selectedTd.dataGroup eq _dg ? '../graphics/icon/ok.png' : ''}" />

                            </c:forEach>

                        </rich:menuGroup>

                        <rich:menuItem id="saveAsXls" value="xls" action="#{ViewTrialData.downloadXls(viewTrialDataMenu.selectedTd.id)}" />

                        <rich:menuItem value="#{messages['label.history']}" action="#{ViewTrialData.undo (viewTrialDataMenu.selectedTd)}" />

                        <rich:menuItem rendered="#{not viewTrialDataMenu.selectedTd.invalid}"

                            disabled="#{viewTrialDataMenu.selectedTd.trialform.fillOnce}"

                            value="#{messages['label.invalidate']}"

                            action="#{ViewTrialData.invalidate(viewTrialDataMenu.selectedTd)}" />

                        <rich:menuItem rendered="#{viewTrialDataMenu.selectedTd.invalid}"

                            value="#{messages['label.validate']}"

                            action="#{ViewTrialData.validate(viewTrialDataMenu.selectedTd)}" />

                        <c:forEach

                                    items="#{ViewTrialData.trialDataGroupContextMenuTdFragments}"

                                    var="fragment">

                            <ui:include id="fragmentInclude"

                                        src="#{fragment.fragmentUrl}" />

                        </c:forEach>

                    </rich:contextMenu>

                   

                    <rich:contextMenu id="dgMenu" attached="false" mode="client" showEvent="click" submitMode="ajax">

                        <rich:menuItem value="#{messages['button.deletegroup']}"

                                    disabled="#{ViewTrialData.trialDataExists(viewTrialDataMenu.selectedDg)}"

                                    action="#{ViewTrialData.deleteGroup(viewTrialDataMenu.selectedDg)}"

                                    reRender="dataGroupsOutput, dataGroupOverview"

                                    onclick="doAction=false;" status="globalStatus" />

                        <rich:menuItem value="#{messages['button.changegroupname']}"

                                    onclick="doAction=false;"

                                    oncomplete="Richfaces.showModalPanel('changeGroupNameMP')"

                                    reRender="changeGroupNameMP" status="globalStatus" />

                        <c:forEach

                                    items="#{ViewTrialData.trialDataGroupContextMenuFragments}"

                                    var="fragment">

                            <ui:include id="fragmentInclude"

                                        src="#{fragment.fragmentUrl}" />

                        </c:forEach>

                    </rich:contextMenu>

                </h:form>

             

            ...

             

            </ui:composition>

             

            Best Regards,

            Lee