This is how I do it now:
1) Prepare a form:
var text =
'<form id="downloadFormPOST" action="" method="post"
accept-charset="UTF-8" target="_blank">' +
'<input type="hidden" name="loginName" value="">' +
'<input type="hidden" name="password" value="">' +
'<input type="hidden" name="export:timezoneOffsetMinutes"
value="'+this.getTimezoneOffsetMinutes()+'">' +
'</form>';
var hiddenForm = new qx.ui.embed.Html(text);
this.filterGrid.add(hiddenForm, {row: ROW1, column: COL8});
2) And later on button click:
this.exportButton.addListener("execute", function(e){
var downloadForm = window.document.getElementById("downloadFormPOST");
downloadForm.loginName.value = this.getMyLoginName();
downloadForm.password.value = this.getMyPassword();
//http://localhost:8080/io/rest/stat/test.csv
downloadForm.action = "/io/rest/stat/test.csv";
downloadForm.submit();
}, this);
-> I can add any number of more hidden fields with details about my csv
export
-> Using https nobody can read my password or other hidden fields
-> The Download dialog of Firefox pops up in a separate tab (
target="_blank")
regards
Marcel
Helder Magalhães schrieb:
> Hi everyone,
>
>
> thron7-2 wrote:
>
>> I actually don't think that this is trivial.
>>
>>
>
> thron is right: this isn't that trivial. I've played with this a couple of
> months ago, while trying to find a client-side only solution, but I wasn't
> able to reach a cross-implementation solution yet.
>
> In the meantime, the standard way of doing this is using the proper HTTP
> headers in the server-side: "Content-Type" for specifying the file MIME type
> ("text/csv", for example) and "Content-Disposition" [1] to force a download
> and hint for a filename. ;-)
>
>
> Hope this helps,
> Helder
>
>
> [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
>
--
Marcel Ruff
http://www.xmlBlaster.org
http://watchee.net
Phone: +49 7551 309371
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel