3

我想使用带有延迟加载的 Primefaces datascroller。我有一个关于延迟加载的问题。我注意到 Datascroller 调用了两次加载方法。但是,当我将 p:datascroller 更改为 p:datatable 时,延迟加载效果很好。请帮助我,我对 datascroller 延迟加载的问题是什么。

<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>

并且还在java代码中加载方法

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;
    }
4

0 回答 0