0 Replies Latest reply on Feb 29, 2008 1:44 PM by stefan r

    contextMenu and bean action and params

    stefan r Newbie

      hi,
      i am trying to create a context menu on a treenode and pass the "something" to the contextMenu actionListener...
      By something i mean either
      1) anything value client javascript
      2) or better: a attribute of the treenode
      3) or even better: the object (bean) wrapped by the treenode

      i was experimenting with this quite a time now, my code looks like this so far:

      .
      .
      .
      
       <rich:treeNode
       type="category"
       acceptedTypes="course"
       nodeClass="node category_node"
       selectedClass="node_active"
       iconLeaf="webresources/images/courseTree/category.gif"
       >
       <h:outputText value="#{item.name}" />
      
       <rich:componentControl event="oncontextmenu" for="categoryContextMenu" operation="show">
       <f:param value="#{item.name}" name="name" />
       </rich:componentControl>
       </rich:treeNode>
      
      .
      .
      .
       <rich:contextMenu attached="false" id="categoryContextMenu" submitMode="ajax">
       <rich:menuItem ajaxSingle="true" submitMode="ajax" actionListener="#{CourseTreeJsfBean.editCategory}">{name} Bearbeiten
       <a4j:actionparam name="iris" assignTo="#{CourseTreeJsfBean.iris}" value="{name}"/>
       </rich:menuItem>
       <rich:menuItem ajaxSingle="true">Löschen</rich:menuItem>
       <rich:menuItem ajaxSingle="true">Kurs erstellen</rich:menuItem>
       </rich:contextMenu>
      
      .
      .
      .
      


      My Bean:

      public class CourseTreeJsfBean
      {
      .
      .
      .
       private String iris;
      .
      .
      .
       public void editCategory(ActionEvent event)
       {
       HtmlMenuItem item = (HtmlMenuItem) event.getComponent();
      
       }
      .
      .
      .
      }
      


      ... but, to be honest, i dont really know how to really do it.
      hope somebody already did something like this and can just copy/paste a working code, or give me a hint.

      thanks
      BR