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

Layout pitfalls of menus and dialogs


When working with the layout component, we should be aware of the pitfalls of menus and dialogs inside layout units. Beginners often face overlap issues and try to find several workarounds. In fact, there are easy solutions available.

In this recipe, we will show how to overcome these issues. We will integrate p:menubar and p:dialog into layout units.

How to do it…

Let's assume that we have a full-page layout with two layout units, center and north. The north unit contains a menubar component with quite normal options:

<p:layout fullPage="true">
  <p:layoutUnit position="center">
    Center
  </p:layoutUnit>
  <p:layoutUnit position="north" size="80" resizable="false">
    <h:form>
      <p:menubar>
        <p:submenu label="JavaScript Libraries">
          <p:menuitem value="jQuery" url="#"/>
          <p:menuitem value="Yahoo UI" url="#"/>
          <p:menuitem value="Prototype" url="#"/>
    ...