Hello,
I am using the timeline component of PrimeFaces Extensions. For a better performance and less network traffic I need to use the lazyload functionality of this element.
Therefor I have copied the source code of the use case of the showcase (see http://www.primefaces.org/showcase-ext/ ... e/lazy.jsf) and tested it. For this I used the debugger and set a breakpoint in the onLazyLoad-method.
Till now, I was not able to call the onLazyLoad-method - it doesn't work.
But the javascript code in the onstart and oncomplete handler is always being called.
Does someone know how to use the onLazyLoad-Listener?
I am using:
- glassfish server 4.1 with Java8
- the PrimeFaces extensions 3.0.0 (I've also tried it with 3.1.0 from github)
- PrimeFaces 5.2
pe:timeline - lazyload is not working
Please provide an example. And make sure you set ID on pe:timeline and use process="@this" or similar on p:ajax.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
You can use it by change partial state saving to true in web.xml
It works for me. But I need use false if I want use Primefaces ajaxExceptionHandler.
(please read this: http://forum.primefaces.org/viewtopic.php?f=3&t=43470)
So, when I TimelineUpdater.getCurrentInstance, I get null value, and Timeline does no view any change.
This is my timeline code in xhtml:
I try create TimelineEvent without updater, but the result is same.
Code: Select all
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
(please read this: http://forum.primefaces.org/viewtopic.php?f=3&t=43470)
So, when I TimelineUpdater.getCurrentInstance, I get null value, and Timeline does no view any change.
Code: Select all
public void onLazyLoad(TimelineLazyLoadEvent e) {
String id = "mainform:timeline";
TimelineUpdater timelineUpdater = TimelineUpdater.getCurrentInstance(id);
Date startDate = e.getStartDateFirst();
Date endDate = e.getEndDateFirst();
clearTimeline();
List<ScheduleEvent> events = activityService.loadEvents(startDate, endDate, timeZone, currentClient);
for (ScheduleEvent event : events) {
EventHistory eHistoryItem = ((EventHistory) event);
String subjTypeId = "";
if (eHistoryItem.getSubject() != null && (eHistoryItem.getSubject().getSubjectType() != null) && (eHistoryItem.getSubject().getSubjectType().getId() != null)) {
subjTypeId = eHistoryItem.getSubject().getSubjectType().getId().toString();
}
model.add(new TimelineEvent(eHistoryItem.getTitle() + "(" + subjTypeId + ")", event.getStartDate()),timelineUpdater);
}
if (e.hasTwoRanges()) {
events = activityService.loadEvents(e.getStartDateSecond(), e.getEndDateSecond(), timeZone, currentClient);
for (ScheduleEvent event : events) {
model.add(new TimelineEvent(((EventHistory) event).getTitle(), e.getStartDateSecond()), timelineUpdater);
}
}
}
Code: Select all
<h:form id="mainform">
<pe:timeline id="timeline" value="#{activityManager.model}"
start="#{activityManager.currentTime}" widgetVar="timelineWdgt"
var="eventItem" preloadFactor="0.5"
zoomMax="#{activityManager.zoomMax}" zoomable="true" locale="hu"
minHeight="350" showNavigation="true">
<p:ajax event="lazyload" update="@none" process="@form"
listener="#{activityManager.onLazyLoad}" />
</pe:timeline>
</h:form>
Last edited by pzoli on 30 Oct 2015, 22:19, edited 1 time in total.
JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Code: Select all
if (timelineUpdater == null) {
FacesContext fc = FacesContext.getCurrentInstance();
UIComponent uiTimeline = fc.getViewRoot().findComponent(id);
if (uiTimeline instanceof Timeline) {
//RequestContext.getCurrentInstance().update(id);
}
}
JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
I found FULL_STATE_SAVING_VIEW_IDS:
I found on this website:
https://myfaces.apache.org/core20/myfac ... onfig.html
But becaouse of ViewExpiredException needs on every page, I can't use it on page that display Timeline.
I'm not foud context-param or UIComponent attribute that's applicable for partial state saving.
Code: Select all
<context-param>
<param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
<param-value>
/user/alerts.xhtml,/user/clients.xhtml,/user/event_templates.xhtml,/user/groups.xhtml,/user/lessons.xhtml,/user/meetings.xhtml,/user/messagelist.xhtml,/user/reports.xhtml,/user/reportsyear.xhtml,/user/setup.xhtml,/user/visitaday.xhtml,/admin/admin.xhtml,/admin/clientcategory.xhtml,/admin/doctors.xhtml,/admin/import.xhtml,/admin/subjects.xhtml,/admin/users.xhtml
</param-value>
</context-param>
https://myfaces.apache.org/core20/myfac ... onfig.html
But becaouse of ViewExpiredException needs on every page, I can't use it on page that display Timeline.
I'm not foud context-param or UIComponent attribute that's applicable for partial state saving.
JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
In public static TimelineUpdater.getCurrentInstance(String id):
map is null when partial stat saving is false.
Code: Select all
Map<String, TimelineUpdater> map = (Map<String, TimelineUpdater>) fc.getAttributes().get(TimelineUpdater.class.getName());
JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Ok, I know this is independent from state saving, but I try partialSubmit, too:
but nothing.
Code: Select all
<p:ajax event="lazyload" update="@none" process="@form" partialSubmit="true"
listener="#{activityManager.onLazyLoad}" />
JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL
-
- Information
-
Who is online
Users browsing this forum: No registered users and 22 guests