O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Context menu integration

Data components such as DataTable, Tree, and TreeTable have a special integration with the context menu. These components can display a context menu per mouse right-click on any row in DataTable or any node in Tree.

In this recipe, we will integrate a context menu with the Tree component. Integration with DataTable or TreeTable is similar and well described in the PrimeFaces User's Guide documentation of these components (http://primefaces.org/documentation.html).

How to do it...

We will develop a context menu with two menu items, View and Delete. A View item shows the currently selected tree node and the Delete item removes it. We would like to implement this behavior for all tree nodes. The following listing demonstrates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required