1 Reply Latest reply on Dec 3, 2009 9:33 AM by Ilya Shaikovsky

    I'm trying to disable enter hotkey in tree ContextMenu

    Peter Schilling Newbie

      Please look at the code below, I'm trying to develop a folder structure tree with a context menu to add, rename and delete folders. Rename below works fine if I click on the menu item, however it doesn't work if I press enter. I tried unsuccessfully to disable the enter key with richfaces:hotkey.

      Questions:
      1) is hotkey correctly defined in the rename option to disable enter? I saw in other postings that there're some bugs related to hotkey.
      2) Shouldn't the menu work seamlessly regardless on whether the user clicked on the menu option or pressed enter with the menu option selected?
      Thanks


      <h:form id="form1">
       <rich:tree id="tree1" switchType="ajax" style="width:600px"
       nodeSelectListener="#{olapTreeAction.selectionListener}" ajaxSubmitSelection="true"
       value="#{olapTree.root}" var="node" nodeFace="#{node.type}" rightClickSelection="true">
       <rich:treeNode id="fnode" type="F" onselected="getNodeIdentifier();">
       <h:outputText id="ftext" value="#{node.text}" />
       <rich:contextMenu event="oncontextmenu" attached="true"
       attachTo="fnode" submitMode="ajax">
      
       <rich:menuItem style="font-weight:bold;" value="#{node.text}" />
       <rich:menuSeparator />
       <rich:menuItem value="Rename to " reRender="tree1"
       actionListener="#{olapTreeAction.renameFolder}" id="rename">
       <rich:hotKey key="return" handler="return false;" disableInInput="true" />
       <f:setPropertyActionListener target="#{olapTreeAction.nodeId}"
       value="#{node.identifier}" />
       <h:inputText label="newname" id="newname" value="#{node.text}"/>
       </rich:menuItem>
       <rich:menuItem value="Create New Sub-Folder" reRender="tree1"
       actionListener="#{olapTreeAction.createNewSubFolder}" id="newsubfolder">
       <f:setPropertyActionListener target="#{olapTreeAction.nodeId}"
       value="#{node.identifier}" />
       </rich:menuItem>
       <rich:menuItem value="Remove" reRender="tree1"
       actionListener="#{olapTreeAction.remove}" id="remove">
       <f:setPropertyActionListener target="#{olapTreeAction.nodeId}"
       value="#{node.identifier}" />
       </rich:menuItem>
       </rich:contextMenu>
       </rich:treeNode>
       <rich:treeNode id="mqnode" type="MQ"
       onselected="getNodeIdentifier();">
       <h:outputText id="mqtext" value="#{node.text}" />
       </rich:treeNode>
       </rich:tree>
       </h:form>