加载指示器页面XPages中的全部刷新 [英] Loading Indicator Page Full Refresh in XPages

查看:61
本文介绍了加载指示器页面XPages中的全部刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的XPages中有很多设计元素.根据连接速度,页面加载所需的时间超出预期.我想创建一个指示符来显示登录的用户页面正在加载" ...我进行了部分刷新,效果很好,但是我无法进行完全刷新.我一直在寻找解决方案. 我可以尝试使用jquery,dojo或ajax.

One of my XPages there are mo many design elements. The page takes time to load more than expected according to connection speed. I would like to create an indicator to show the logged user "The page is loading"... I made it for partial refresh and it works great but i couldn't make it for full refresh. I have been looking for a solution for this. I can try jquery, dojo or ajax.

任何建议都很重要. 问候 C.A.

Any suggestion is important. Regards C.A.

推荐答案

我尚未为此进行专门的NotesIn9展示,但是我在此TLCC网络研讨会中演示了一种技术.
https://www.youtube.com/watch?v = jBaRSM9Ng_o& index = 3& list = PL9nOJ-QrsuFa00dOsdE6EDh_l2fkiYD0D 相关部分从26分钟左右开始.

I've not yet made a dedicated NotesIn9 show for it yet, but I do a demo of a technique in this TLCC webinar.
https://www.youtube.com/watch?v=jBaRSM9Ng_o&index=3&list=PL9nOJ-QrsuFa00dOsdE6EDh_l2fkiYD0D The relevant part starts around the 26 minute part.

我是在初始加载页面时执行此操作的,但是如果您已经在页面上,我敢肯定可以进行完全刷新.

I'm doing this on loading the page initial but I'm sure could be adapted for a full refresh if you were already on the page.

基本概念是页面加载,实际上您不会加载任何长时间运行的数据.您只是发送了页面的外壳,然后在onClientLoad事件中触发了部分刷新.

The basic concept is on page load you don't actually load any long running data. You just sent the shell of the page and then in the onClientLoad event you trigger a partial refresh.

<xp:this.resources>
    <xp:script src="/xpUtilities.jss" clientSide="false"></xp:script>
    <xp:dojoModule name="extlib.dijit.ExtLib"></xp:dojoModule>
    <xp:dojoModule name="extlib.dijit.Loading"></xp:dojoModule>
    <xp:styleSheet href="/app.css"></xp:styleSheet>
</xp:this.resources>
Page 1


<xp:this.beforePageLoad><![CDATA[#{javascript:viewScope.put("vsHasData", false);}]]></xp:this.beforePageLoad>
&#160;&#160;-&#160;&#160;Header UI goes here....<xp:br></xp:br>
<xp:br></xp:br>

<xp:br></xp:br>

<xp:panel id="MainContentWrapper">
<xp:panel id="MainContent">

    <xp:this.rendered><![CDATA[#{javascript:return viewScope.get("vsHasData");}]]></xp:this.rendered>
    <xp:br></xp:br>

    <xp:repeat id="repeat1" rows="100" var="rowData"
        indexVar="rowIdx">
        <xp:this.value><![CDATA[#{javascript:viewScope.get("vsStateMap").keySet()}]]></xp:this.value>
        <xp:text escape="true" id="computedField2"
            value="#{rowData}">
        </xp:text>
        -
        <xp:text escape="true" id="computedField3">
            <xp:this.value><![CDATA[#{javascript:viewScope.get("vsStateMap").get(rowData)}]]></xp:this.value>
            <xp:this.converter>
                <xp:convertNumber type="number"
                    integerOnly="true">
                </xp:convertNumber>
            </xp:this.converter>
        </xp:text>
        <xp:br></xp:br>
    </xp:repeat>
    <xp:br></xp:br>
    <xp:br></xp:br>
</xp:panel>
</xp:panel>
<xp:eventHandler event="onClientLoad" submit="true" refreshMode="partial" refreshId="MainContentWrapper">
    <xp:this.action><![CDATA[#{javascript:return getStateTotals();}]]></xp:this.action>
    <xp:this.onStart><![CDATA[XSP.startAjaxLoading("Calculating State Totals. This may take a few moments.")]]></xp:this.onStart>
    <xp:this.onComplete><![CDATA[XSP.endAjaxLoading()]]></xp:this.onComplete>
    <xp:this.onError><![CDATA[XSP.endAjaxLoading()]]></xp:this.onError>
</xp:eventHandler>

那是一个演示页面.要看的东西是添加的dojo资源,这一事实是我开始隐藏"MainContent",然后是作用域变量,然后是onClientLoad位的末尾.

That's a demo page. The stuff to look at is for dojo resources that are added, the fact that I start off hiding the "MainContent" vie a scoped variable and then the end onClientLoad bit.

因此将加载页面,但是用于生成重复控件的数据不会运行,因为它位于未渲染的面板中.因此,用户可以立即进入页面.然后onClientLoad起作用-在启动时显示请稍候"之类的东西,然后运行该函数以获取数据. 数据完成后,我设置了scopedVariable来显示mainContent区域,然后触发endAjaxLoading东西并显示所有内容.

So the page loads, but the data to generate the repeat control does NOT run because it's in a non rendered panel. So the users get to the page instantly. Then the onClientLoad kicks - on Start it shows a "Please Wait" kind of thing then runs the function to get the data. When the data is completed, I set a scopedVariable to then show the mainContent area and the endAjaxLoading stuff then triggers and everything gets displayed.

这篇关于加载指示器页面XPages中的全部刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆