Book Image

PrimeFaces Cookbook

Book Image

PrimeFaces Cookbook

Overview of this book

Table of Contents (20 chapters)
PrimeFaces Cookbook Second Edition
Credits
Foreword
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

TieredMenu – submenus in nested overlays


A tiered menu displays nested submenus as overlays. A tiered menu features the same common behaviors as every PrimeFaces menu—it consists of (nested) submenus and menu items that can be built declaratively or programmatically by modeling. The main difference from the default menu described in the Statically and dynamically positioned menus recipe of this chapter is the part about displaying with overlays. The positioning of the tiered menu is static by default, but it can also be positioned relative to a trigger that shows the menu.

In this recipe, we will develop static and dynamic tiered menus. A dynamic tiered menu will be shown after a click on a button acting as the trigger. Furthermore, you will learn about the autodisplay feature.

How to do it…

The following code listing demonstrates three tiered menus: static (default), static without the autodisplay feature, and dynamic. As the trigger for the dynamic menu, we will take a p:commandButton tag...