Book Image

Primefaces Cookbook Second Edition

Book Image

Primefaces Cookbook Second Edition

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

SlideMenu – menu in the iPod style


A slide menu displays nested submenus as slides with animation similar to the iPod menu. A slide 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 the model. The main difference from other menu types is a slide animation when displaying submenus. The positioning of the slide 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 a slide menu with a button acting as the trigger. When the user pushes the button, the menu will be displayed in an overlay.

How to do it…

We will take p:commandButton as the trigger. The p:slideMenu tag, representing a slide menu, has a trigger attribute that points to the ID of p:commandButton. The slide menu consists of submenus (slides) with menu items sending AJAX, non-AJAX (ajax="false"), and GET requests (url is not null). The following...