admin管理员组文章数量:1310420
I would like to use a Dojo button to download an Excel or a PDF file. So far I've managed to do it by using a call to dojo.io.iframe
in the onClick
handler of the button. However, this will only download the file once. Any successive calls will be ignored.
This is the call:
function exportToExcel() {
dojo.io.iframe.send({
url: '/report/export',
handleAs: 'xml',
content: {
__export: 'excel'
}
});
}
As if the dojo.io.iframe
does not consider the previous request to be pleted.
What am I doing wrong?
I would like to use a Dojo button to download an Excel or a PDF file. So far I've managed to do it by using a call to dojo.io.iframe
in the onClick
handler of the button. However, this will only download the file once. Any successive calls will be ignored.
This is the call:
function exportToExcel() {
dojo.io.iframe.send({
url: '/report/export',
handleAs: 'xml',
content: {
__export: 'excel'
}
});
}
As if the dojo.io.iframe
does not consider the previous request to be pleted.
What am I doing wrong?
Share Improve this question asked Dec 31, 2010 at 14:17 AriodAriod 5,85122 gold badges77 silver badges104 bronze badges1 Answer
Reset to default 7If you use dojo.io.iframe.send
, then the response should be in certain format to tell dojo that the request is pleted. The response should be wrapped in the <textarea>
element of a HTML document. As in your case, the response is a binary stream, so dojo didn't know whether the request is pleted. If you didn't specify a timeout
, dojo will wait forever.
To achieve the task, you can use following approach:
var downloadPdfIframeName = "downloadPdfIframe";
var iframe = dojo.io.iframe.create(downloadPdfIframeName);
dojo.io.iframe.setSrc(iframe, url, true);
本文标签: javascriptdojoioiframe and download of ExcelPDFStack Overflow
版权声明:本文标题:javascript - dojo.io.iframe and download of ExcelPDF - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741791422a2397679.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论