Managing events with schedule by leveraging lazy loading

The Schedule component provides a calendar to manage events, such as Outlook Calendar and iCal. By default, a whole set of events is eagerly provided via the ScheduleModel class. That means all events are loaded at once on page load. The lazy loading feature helps to improve performance if we have a huge dataset of events or if events take too much time to load. In the lazy loading mode, only events that belong to the displayed timeframe are fetched.

In this recipe, we will implement a small example for the Schedule component's lazy loading feature.

How to do it…

A basic definition of schedule would be as shown here:

<p:schedule id="lazySchedule"
  value="#{scheduleBean.lazyScheduleModel}"/>

Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.