【问题标题】:JSF Richfaces datatable and datascroller loadingJSF Richfaces 数据表和数据滚动加载
【发布时间】:2013-07-02 06:34:17
【问题描述】:

我想知道在我加载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>

【问题讨论】:

    标签: jsf richfaces overlay loading


    【解决方案1】:

    我找到了替代方法

    我在页面加载期间将光标更改为加载时钟

    将以下内容添加到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
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-08-24
      • 1970-01-01
      • 2013-10-03
      • 2011-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-08
      • 2015-04-18
      相关资源
      最近更新 更多