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

PanelGrid with colspan and rowspan support


The panelGrid component extends the JSF's <h:panelGrid> component with the support of colspan, that is, the number of columns a cell should span, and rowspan, which is the number of rows a cell should span, and the theming ability. In this recipe, we will create panels with row and column span abilities.

How to do it…

A basic definition of the panel grid would be as follows:

<p:panelGrid columns="2">
  <f:facet name="header">User Information</f:facet>
  <h:outputLabel for="firstname" value="First Name" />
  <p:inputText id="firstname" value="" label="firstname" />
  <h:outputLabel for="lastname" value="Last Name" />
  <p:inputText id="lastname" value="" required="true"
    label="lastname"/>
  <f:facet name="footer">
    <p:commandButton type="button" value="Save"
      icon="ui-icon-check" style="margin:0"/>
   </f:facet>
</p:panelGrid>

This will render two columns with header...