1 Reply Latest reply on Sep 26, 2008 6:34 AM by ilya_shaikovsky

    <rich:menuItem> -- action method gets called twice

    oggmeister

      Hello,

      I've got the following form containing a <rich:dropDownMenu>:

      <h:form>
       <rich:dataTable value="#{analysisJobList}" var="job" rows="20" id="analysisJobTable">
      
       ...
      
       <rich:column styleClass="jobListSmallColumn" rendered="#{actionsColumn}">
       <f:facet name="header">
       <h:outputText value="Actions" />
       </f:facet>
       <rich:dropDownMenu rendered="#{job.state != 2}"
       value="actions >"
       direction="bottom-left"
       jointPoint="tl"
       submitMode="server">
       <a4j:support event="onexpand" action="#{isPoll.setPoll(false)}" reRender="poll" />
       <a4j:support event="oncollapse" action="#{isPoll.setPoll(true)}" reRender="poll" />
       <rich:menuItem styleClass="popupMenuItem" action="#{analysisJobModificationHandler.moveForward(job)}" value="Move Forward" rendered="#{job.state == 1}"/>
       <rich:menuItem styleClass="popupMenuItem" action="#{analysisJobModificationHandler.moveBackward(job)}" value="Move Backward" rendered="#{job.state == 1}"/>
       <rich:menuSeparator rendered="#{job.state == 1}"/>
       <rich:menuItem styleClass="popupMenuItem" action="#{deleteAnalysisJobAction.delete(job.id)}" value="Delete"/>
       </rich:dropDownMenu>
       <h:commandLink action="#{deleteAnalysisJobAction.delete(job.id)}" value="Delete"/>
       </rich:column>
      
       ...
      
       </rich:dataTable>
      </h:form>
      


      The 'Delete' menu item is causing me some trouble. When selecting it, its action method gets invoked twice, which is unfortunate since it begins a Seam conversation. Clinking the subsequent <h:commandLink> however results in only one call to the same action method.

      When switching the dropDownMenu's submitMode to 'ajax' the call happens only once as well but since the form doesn't get submitted, navigation is not performed.

      Any hint what might cause the problem?

      Thanks!