• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

Horizontal Tree ContextMenu

ContextMenu has special integration with Tree. Even different menus can be assigned to different node types by matching node types.

ContextMenu Tag Documentation

ContextMenu provides an overlay menu displayed on mouse right-click event.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
appendTo String false @(body) Search expression for the element to which the menu overlay is appended.
autoDisplay boolean false true Defines whether the first level of submenus will be displayed on mouseover or click event.
beforeShow String false Client side callback to execute before showing.
dir String false ltr Defines text direction, valid values are ltr and rtl.
disabled boolean false false If true, prevents menu from being shown
event String false Event to bind contextMenu display, default is contextmenu aka right click.
for String false Id of the component to attach to
hideDelay int false 0 Delay in milliseconds before hiding the submenu, if 0 not hidden until document.click().
model MenuModel false Menu model instance to create menu programmatically.
nodeType String false Specific type of tree nodes to attach to.
selectionMode String false multiple Defines the selection behavior, e.g., "single" or "multiple".
showDelay int false 0 Delay in milliseconds before displaying the submenu. Default is 0 meaning immediate.
style String false Inline style of the component.
styleClass String false Style class of the component.
tabindex String false 0 Position of the element in the tabbing order.
targetFilter String false Selector to filter the elements to attach the menu.
toggleEvent String false Event to toggle the submenus, valid values are "hover" and "click".
touchable Boolean false Enable touch if supported by device. NULL uses global default or primefaces.TOUCHABLE. Default: globally enabled.
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc Basic Icon Selection Events ContextMenu
Files

Usage


<div class="card">
    <h:form>
        <p:growl id="messages" showDetail="true"/>

        <p:tree id="docs" value="#{treeContextMenuView.root}" var="doc" selectionMode="single"
                selection="#{treeContextMenuView.selectedNode}" orientation="horizontal" dynamic="true">
            <p:treeNode expandedIcon="pi pi-folder-open" collapsedIcon="pi pi-folder">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
            <p:treeNode type="app" icon="pi pi-save">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
            <p:treeNode type="document" icon="pi pi-file">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
            <p:treeNode type="excel" icon="pi pi-file-excel">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
            <p:treeNode type="travel" icon="pi pi-file-pdf">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
            <p:treeNode type="picture" icon="pi pi-image">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
            <p:treeNode type="video" icon="pi pi-video">
                <h:outputText value="#{doc.name}"/>
            </p:treeNode>
        </p:tree>

        <p:contextMenu for="docs">
            <p:menuitem value="View" update="messages" action="#{treeContextMenuView.displaySelectedSingle}"
                        icon="pi pi-search"/>
        </p:contextMenu>
    </h:form>
</div>