1 Reply Latest reply on Aug 5, 2009 5:34 PM by nbelaevski

    Dynamically attaching ContextMenu to TreeNode

      I need to dynamically attach context menus to tree nodes. I need to do this in the backing bean because only the nodes that's not a leaf should have the context menu. I don't think I can insert a if logic tag in JSF...

      // create a new node
      TreeNode node = new TreeNodeImpl();
      node.setData("my new node");

      // create a new context menu
      ContextMenu cm = new ContextMenu();

      // create a new menu item
      HtmlMenuItem menuItem = new HtmlMenuItem();
      menuItem.setValue("my new context menu");

      // todo: attach the above menu item to the context menu

      // todo: attach the context menu to the tree node


      Does anyone know what needs to be done so that i can attach the context menu to the treenode?

      Thanks.