POI 4 XPage - 文档生成仅工作一次 [英] POI 4 XPages - document generation works only once

查看:27
本文介绍了POI 4 XPage - 文档生成仅工作一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,老实说:标题并没有说出全部真相.我正在使用带有多个按钮(保存、关闭、编辑等)和一个执行 POI 操作的按钮的自定义控件 - 它生成一个 Word 文件.我在这里遇到一个问题:点击 POI 按钮后,我的其他按钮(以及 POI 按钮)将不再工作,没有触发点击.现在奇怪的是:等待几秒钟后(取决于我使用的浏览器,Chrome 最快)我可以再次单击按钮(所有按钮),以便我可以例如离开(关闭)或编辑我的 Xpage.

Ok, to be honest: the headline doesn't tell the whole truth. I am using a custom control with several buttons (save, close, edit etc.) and a button that executes a POI action - it's generates a Word file. I experience a problem here: after hitting the POI-button my other buttons (and the POI one as well) won't work anymore, no click is triggered. Now the strange one: after waiting a few seconds (depending on which browser I use, Chrome is fastest) I am able to click the buttons (all of them) again so that I can e.g. leave (close) or edit my Xpage.

我不知道这是否有帮助,但这是我的 POI 按钮的事件代码:

I don't know if that helps but here is the event code of my POI button:

<xp:button id="button5" styleClass="btn btn-sm printbutton"
            style="display:none">
            <i class="fa fa-print"></i>
            &#160;
            <xp:text>
                <xp:this.value><![CDATA[#{javascript:"Nach MS Word exportieren"}]]></xp:this.value>
            </xp:text>

            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action>

                    <xp:actionGroup>
                        <xp_1:generateDocument documentId="wordprint"
                            loaded="true">
                        </xp_1:generateDocument>
                    </xp:actionGroup>
                </xp:this.action>
            </xp:eventHandler>
        </xp:button>

有什么想法可以避免这种行为,还是 POI 4 XPage 中的错误?

Any ideas how to avoid this behavior or is it a bug in POI 4 XPages?

顺便说一句:我无法在获取 Word 文档后立即执行另一个操作,例如执行脚本或打开页面.这也是在打印"后关闭 xpages 的一种可接受的方式.

BTW: I am not able to execute another action right after getting the Word document, e.g. execute a script or open a page. That would be also an acceptable way to close the xpages after "printing".

提前致谢!

推荐答案

Oliver,将客户端 JS 调用 XSP.allowSubmit() 添加到您的按钮,以便在按下按钮后允许新的提交按钮:

Oliver, add the client-side JS call XSP.allowSubmit() to your button in order to allow new submits after pressing the button:

<xp:button id="button5" styleClass="btn btn-sm printbutton" style="display:none">
        <i class="fa fa-print"></i>
        &#160;
        <xp:text>
            <xp:this.value><![CDATA[#{javascript:"Nach MS Word exportieren"}]]></xp:this.value>
        </xp:text>

        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action>
                <xp:actionGroup>
                    <xp_1:generateDocument documentId="wordprint"
                        loaded="true">
                    </xp_1:generateDocument>
                </xp:actionGroup>
            </xp:this.action>
            <xp:this.script><![CDATA[XSP.allowSubmit()]]></xp:this.script>
        </xp:eventHandler>
    </xp:button>

这篇关于POI 4 XPage - 文档生成仅工作一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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