2 Replies Latest reply on Sep 17, 2009 6:15 AM by Kerdudou Ronan

    menuItem Action clear events ?

    Kerdudou Ronan Apprentice

      Hi,

      I wonder why a menuItem clears events on 'onmousedown' ans 'onmouseup' ?

      Thi cause some issues in my app because if an 'input' is being edited by a user and there is a 'onchange' on it to send the value to the server. then if the user uses a menuItem Action, then the value is never submitted (the action isn't called)

      I think the code generated for the menuItem is the cause of the problem :
      onmousedown="Event.stop(event); "
      onmouseup="Event.stop(event); "

      To have a correct comportement of the appli, the user must manually blur the input before taking action in the menuItem.

      Solution 1 : remove Event.stop from menuItem
      Solution 2 : force blur on any form component when using the menuItem

      Note that menuItems are used for global Menu of the app, but also in tables on each rows to give full options to interact with the row.
      So this second case is comonly used by users.
      (the subition of the value is temporarily resolved by removing ajaxSingle on the menuItem, but in some case the 'onchange' of the input also need to call a specific action, and then we have no solution for the issue.

      Thanks in advance for any suggestion...

      exemple code :

      <rich:column>
       <h:inputText styleClass="input"
       value="#{rowItem.string}">
       <a4j:support event="onchange"
       action="#{handler.notifyChange}"
       ajaxSingle="true">
       <f:setPropertyActionListener target="#{handler.paramForNotifyChange}" value="#{rowItem}"/>
       </a4j:support>
       </h:inputText>
      </rich:column>
      <rich:column>
       <rich:dropDownMenu direction="bottom-left" jointPoint="br" hideDelay="300">
       <f:facet name="label">
       <h:graphicImage value='#{icones["MoreAction"]}'/>
       </f:facet>
       <rich:menuItem value="Do Something"
       submitMode="ajax"
       action="#{handler.onClickDoSomething}"
       ajaxSingle="true"
       reRender="container"
       onclick="typeLien=L_GROUPE;"
       icon="#{icones['Something']}">
       <a4j:actionparam assignTo="#{handler.paramId}" value="#{rowItem.id}" name="idItem" />
       </rich:menuItem>
       <rich:dropDownMenu>
      </rich:column>