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

Listing data with orderList


The orderList component is used to sort a collection with the support of drag-and-drop reordering, transition effects, and POJO support.

How to do it…

A basic definition for the orderList that sorts a collection of strings would be as shown here:

<p:orderList id="simple" value="#{orderListBean.countries}"
  var="country" itemLabel="#{country}" itemValue="#{country}" />

The visual output of the component will be as shown here:

There's more…

To define a header on top of orderList, a facet with the name caption should be provided as shown here:

<p:orderList id="withCaption" value="#{orderListBean.countries}"
  var="country" itemLabel="#{country}" itemValue="#{country}">
  <f:facet name="caption">
    Countries
  </f:facet>
</p:orderList>

With the controlsLocation attribute, we can control the position of the controls. The default value is left; the other possible values are right and none.

Transition effects

Effects can be applied with the effect...