3

I want to use Primefaces datascroller with lazy loading.I have a problem about lazy loading.I noticed that Datascroller called load method twice.However,When I change p:datascroller with p:datatable,Lazy Loading works very well.Please help me,what is the my problem about datascroller lazy load.

<p:dataScroller 
                id="messagesDataScroller"  
                value="#{messagesGridDialogBean.items}" 
                lazy="true" 
                var="item" 
                widgetVar="messagesDataScroller" 

                mode="inline"
                chunkSize="#{messagesGridDialogBean.items.rowCount}"
                rowIndexVar="rowIndex"
                scrollHeight="400" >
                <f:facet name="header">
                        Mesajlar
                </f:facet>

                <h:panelGrid   columns="2" style="width:400px" >


                            <h:outputText value="#{strings.messages_send_date}" style="font-weight: bold"  />
                            <h:outputText value="#{item.messageSendDate}"   >
                                <f:converter converterId="GregorianCalendarConverter" />
                                    <f:attribute name="pattern" value="dd/MM/yyyy HH:mm" />
                            </h:outputText>

                            <h:outputText value="#{strings.messages_subject}  " style="font-weight: bold" /> 
                            <h:outputText value="#{item.jobWarning.warningText}"  />



                            <h:outputText value="#{strings.global_description}  " style="font-weight: bold" /> 
                            <h:outputText value="#{item.description}"  escape="false" />

                            <p:spacer height="3" />
                            <p:spacer height="3" />


                </h:panelGrid>
                            <p:commandButton title="#{strings.messages_readMessage}" icon="ui-icon-check" actionListener="#{messagesFormBean.checkMessageRead(item.tblId,2)}" update="messagesDataScroller" />
<p:commandButton title="#{strings.messages_sendArchieve}" icon="ui-icon-folder-collapsed"  actionListener="#{messagesFormBean.checkMessageRead(item.tblId,3)}" update="messagesDataScroller" />
            </p:dataScroller>

And also load method in java code

public List<JobWarningUsers> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,Object> filters) {
        this.setRowCount((int) service.messageCount());// TODO make safe cast
        List<JobWarningUsers> lst=new ArrayList<JobWarningUsers>();
        lst=service.load(first, pageSize, sortField, tr.gov.diski.tender.common.GenericDao.SortOrder.valueOf(SortOrder.DESCENDING.name()), filters);
        return lst;
    }
caglarturkurka
  • 116
  • 1
  • 9
  • I have encountered the same - my problem is that the lazy model is statefull, which means that loading twice returns different results. Did you get to any conclusion yet? – nuno Mar 27 '15 at 12:48
  • possible duplicate of [Primefaces lazy datascroller calling load twice](http://stackoverflow.com/questions/29303228/primefaces-lazy-datascroller-calling-load-twice) – Kukeltje May 20 '15 at 20:58
  • Seems the issue was fixed in version 5.3 https://github.com/primefaces/primefaces/issues/390 – Oleksa O. Nov 24 '17 at 13:37

0 Answers0