簡體   English   中英

JSF Richfaces數據表和數據滾動器加載

[英]JSF Richfaces datatable and datascroller loading

我想知道在我加載rich:datatable時(主要在第一次顯示時,以及每次rich:dataScroller中的頁面更改時)是否有可能在頁面上出現“加載”疊加層,實在太慢了。

這是我目前的情況:

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:sec="http://www.springframework.org/security/tags" xmlns:p="http://primefaces.org/ui">
<f:view>
    <h:form>
         <!-- some more content -->  
        <rich:dataTable width="500" id="attendanceList" reRender="scroller"
            rows="#{bean.getRowsAmount()}" columnClasses="attendance"
            rowClasses="even-row, odd-row"
            value="#{bean.getList()}" var="a"
            style="width:100%" rendered="#{attendance.renderList}">
            <f:facet name="header">
                <rich:columnGroup>
                    <h:column rendered="#{bean.renderColumn}">
                        <h:commandLink styleClass="order-table-header" value="Column Header" action="#{bean.columnSorting()}" />
                    </h:column>
                    <!-- more columns -->
                </rich:columnGroup>
            </f:facet>
            <h:column rendered="#{bean.renderColumn}">
                <h:outputText value="#{bean.columnConent}" />
            </h:column>
            <!-- more columns -->
            <f:facet name="footer" id="tot">
                <rich:dataScroller id="scroller" for="attendanceList" maxPages="15"
                    fastControls="hide" page="#{bean.scrollerPage}"
                    rendered="#{bean.renderScroller}">
                    <f:facet name="first">
                        <h:outputText value="First" />
                    </f:facet>
                    <f:facet name="last">
                        <h:outputText value="Last" />
                    </f:facet>
                    <f:facet name="previous">
                        <h:outputText value="Previous" />
                    </f:facet>
                    <f:facet name="next">
                        <h:outputText value="Next" />
                    </f:facet>
                </rich:dataScroller>

            </f:facet>
        </rich:dataTable>
    </h:form>
</f:view>

我找到了替代方案

我在頁面加載期間將光標更改為加載時鍾

將以下內容添加到rich:dataScroller標記屬性中:

onbegin="waitCursor(true)" oncomplete="waitCursor(false)"

和以下腳本

waitCursor=function(wait){
  if (wait) {
    document.body.style.cursor = "wait"; // just the clock
    //document.body.style.cursor = "url(images/mywaitcursor.cur), progress"; // custom cursor, on non supporting browsers would default to clock
    //document.body.style.cursor = "progress"; // arrow and clock (so you can still click anything)
    // anyway, if you have defined cursors with CSS for other regions in your page
    // this wait cursor will be overriden when hovering over those regions
  } else {
    document.body.style.cursor = ""; // so it goes back to previous CSS defined value
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM