2 Replies Latest reply on Sep 1, 2008 6:22 AM by Ilya Shaikovsky

    componentControl inside contextMenu

    Veljko Vujcic Newbie

      greetings!

      i have the following code which is working properly except for the part which should open modal panel

      <rich:panel>
       <f:facet name="header">
       <h:outputText value="#{messages['ManageClassifications']}" />
       </f:facet>
       <rich:modalPanel id="mpClassification" minHeight="300"
       minWidth="650" zindex="2000" autosized="true">
       <f:facet name="header">
       <h:outputText value="#{messages['NewClassification']}" />
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="img/16x16/actions/cancel.png"
       style="cursor:pointer"
       onclick="Richfaces.hideModalPanel('mpClassification')" />
       </f:facet>
       </rich:modalPanel>
       <rich:contextMenu attached="false" id="menu">
       <rich:menuItem action="#{classificationLinker.createNode}"
       onselect="javascript:Richfaces.showModalPanel('mpClassification',{width:650, top:200})">
       <f:param value="{clasid}" name="siblingId" />
       <b>option1</b>
       </rich:menuItem>
       <rich:menuItem action="#{classificationLinker.createNode}"
       onclick="javascript:Richfaces.showModalPanel('mpClassification',{width:650, top:200})">
       <f:param value="{clasid}" name="siblingId" />
       <b>option2</b>
       </rich:menuItem>
       <rich:menuItem action="#{classificationLinker.createLeaf}">
       <f:param value="{clasid}" name="parentId" />
       <b>option3</b>
       <rich:componentControl disableDefault="true" event="onselect"
       for="mpClassification" operation="show" />
       </rich:menuItem>
       <rich:menuItem action="#{classificationLinker.createLeaf}">
       <f:param value="{clasid}" name="parentId" />
       <b>option4</b>
       <rich:componentControl disableDefault="true" event="onclick"
       for="mpClassification" operation="show" />
       </rich:menuItem>
       </rich:contextMenu>
       <rich:tree id="treeClassification" switchType="ajax"
       icon="img/CasePics/book_yellow.png"
       iconLeaf="img/CasePics/book_yellow.png" preserveModel="true">
       <rich:recursiveTreeNodesAdaptor included="true"
       roots="#{caseService.classificationRootNodes}"
       nodes="#{classification.childClassifications}"
       var="classification">
       <rich:treeNode>#{classification.name}
       <rich:componentControl event="oncontextmenu" for="menu"
       operation="show">
       <f:param value="#{classification.id}" name="clasid" />
       </rich:componentControl>
       </rich:treeNode>
       </rich:recursiveTreeNodesAdaptor>
       </rich:tree>
       </rich:panel>
      


      essentially, user should be shown a tree and then on right-click get a context menu, select an option which should first trigger an action and then show modal panel. i put four options to illustrate the behavior:

      option1 - shows modal panel for less than a second, then triggers the action and closes modal panel
      option2 - triggers action only
      option3 - does nothing!
      option4 - triggers action only

      and my second question is: how do i trigger action first and then show modal panel, in other words i'd like to achieve same behavior as with pageflow "trigger action, and then from action redirect etc."

      thanks a lot