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

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

    Daniel Behrwind Newbie


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

       <rich:dataTable value="#{analysisJobList}" var="job" rows="20" id="analysisJobTable">
       <rich:column styleClass="jobListSmallColumn" rendered="#{actionsColumn}">
       <f:facet name="header">
       <h:outputText value="Actions" />
       <rich:dropDownMenu rendered="#{job.state != 2}"
       value="actions >"
       <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"/>
       <h:commandLink action="#{deleteAnalysisJobAction.delete(job.id)}" value="Delete"/>

      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?