Primefaces DataScroller

时间:2015-02-24 18:21:06

标签: primefaces lazy-loading datascroller

我想使用延迟加载的Primefaces datascroller。我有一个关于延迟加载的问题。我注意到Datascroller调用了load方法两次。但是,当我用p:datatable更改p:datascroller时,Lazy Loading运行得很好。请使用帮帮我,关于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代码中的load方法

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

0 个答案:

没有答案