I am using a schedule in my application like this:
<p:schedule id="performanceSchedule" value="#{performanceScheduleView.eventModel}" />
Another component modifies the schedule's datamodel by calling this method of the view:
private void updatePerformances() {
eventModel.clear();
for (final PerformanceModel perf : dataStorage.getPerformancesForVenue(activeVenueId)) {
final ArtistModel artist = dataStorage.getArtistById(perf.getArtistId());
final Date perfStart = perf.getDate();
final Date perfEnd = new Date(perfStart.getTime() + 1000 * 60 * 60);
eventModel.addEvent(new DefaultScheduleEvent(artist.getName(), perfStart, perfEnd));
}
}
But this means the user has to go to another date and back, else the changes are not visible to the client.
My first idea was to do polling like this:
<h:form>
<p:poll interval="1" update="performanceSchedule" />
</h:form>
But this causes the schedule to jump to the current date and makes it unusable.
Any suggestions how to workaround that problem?