Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

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>

Any ideas how to avoid this behavior or is it a bug in POI 4 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".

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
855 views
Welcome To Ask or Share your Answers For Others

1 Answer

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...