Onclick The Button To Export Excel In XPages
I found the code on the website: https://www.xpagedomino.com/2015/02/xpage-export-to-excel-using-javascript.html Now I have : a view one button I want to use the button to expor
Solution 1:
Your Button executes ServerSide Script. When using <xp:this.script> it worked for me.
<xp:button value="Export5" id="button5">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[
var viewPanel = document.getElementById("#{id:viewPanel1}");
var html = viewPanel.outerHTML;
window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html));]]>
</xp:this.script>
</xp:eventHandler>
</xp:button>
Solution 2:
This may not fix your problem, but the line below is a better way to reference an element by its id in csjs:
var viewPanel1Id = document.getElementById("#{id:viewPanel1}")
Post a Comment for "Onclick The Button To Export Excel In XPages"