开发者

Primefaces 3.0 : TreeNode and ContextMenu

In my application, I have a tree with various object types (sources, tables, etc). I'd like to enable a context menu for the different types of object (add, delete, edit etc).

How can I use context menu on tr开发者_JS百科ee nodes in Primefaces ?


Never did it in practice (I am still on Primefaces 2.x), but from theory the facelet code should look something like this:

<h:form>
  <p:tree value="#{myBean.tree}" var="node" id="tree"
          selectionMode="single" selection="#{myBean.selectedNode}">
     <p:treeNode>
        <h:outputText value="#{node}" />
     </p:treeNode>
  </p:tree>

  <p:contextMenu for="tree" id="menu">
    <p:menuitem value="Add" actionListener="#{myBean.add}" />
     ...
  </p:contextMenu>
</h:form>

Usage of p:contextMenu and p:tree is shown in Primefaces showcase.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜