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

AJAX-enhanced drag and drop


The user's client-side drag and drop interactions can be posted to the server. Drag and drop has only one (default) AJAX behavior event provided by the droppable component, which is processed when a valid draggable component is dropped. That is the drop event. If we define a listener, it will be invoked by passing an event instance of the type org.primefaces.event.DragDrop as parameter. This parameter holds information about the dragged and dropped components. Through this information, the server-side state of the draggable/droppable items can be updated.

In this recipe, we will develop a workflow simulating the process of pizza ordering. The pizza ordering should occur by drag and drop. Users should be able to select any available Turkish pizza and drag and drop it onto the order list. The remove functionality, capable of drag and drop, should be included as well. For this purpose, we will implement a trash for the items removed from the pizza items in the order...