*
* @constructor
* @param {Object} cfg Configuration object.
+* @cfg {Object} params params to send
* @cfg {String} url Location to download from.
-* @cfg {String} method GET or POST (default GET), POST will create a form, and post that into the hidden frame.
+* @cfg {String} method (GET|POST) GET or POST (default GET), POST will create a form, and post that into the hidden frame.
* @cfg {Boolean} newWindow (optional) download to new window
* @cfg {String} doctype (optional) download PDF to new window
* @cfg {Boolean} limit (optional) limit for grid downloads.
-
+* @cfg {Boolean} showDownloading default false - show a dialog indicating that the file is downloading
* @cfg {String} csvCols - use '*' to override grid coluns
* @cfg {String} csvTitles - use '*' to override grid coluns
-
+ * @cfg {String} hiddenCols - default 'show' (use 'hide' to not display them on download)
* @cfg {Function} success (optional) MAY fire on download completed (fails on attachments)..
// });
// }
- Roo.log(this.params);
+ //Roo.log(this.params);
+ this.params._get = 1; // always do a post request, with _get passed
for(var i in this.params) {
this.form.append(i, this.params[i]);
/*
}
var req = new XMLHttpRequest();
req.responseType = 'blob';
- req.open(this.method, this.url);
+
+ req.open('POST', this.url);
var _t = this;
req.onload = function( ev )
}
}
-
+ if (this.showDownloading) {
+ Roo.MessageBox.alert("Downloading", "The file should download shortly");
+ }
req.send(this.form);
/*
(function() {
success : false,
failure : false,
+ hiddenCols : 'show', // set to 'hide' to hide them..
+
+ showDownloading : false,
// private..
//used by simple GET method.
createCsvFrame: function()
});
- if(ds.sortInfo && ds.remoteSort){
+ if(ds.sortInfo && ds.remoteSort){
var pn = ds.paramNames;
this.params[pn["sort"]] = ds.sortInfo.field;
this.params[pn["dir"]] = ds.sortInfo.direction;
} else {
Roo.each(this.grid.cm.config, function(c,i) {
+
+ if (t.hiddenCols != 'show' && t.grid.cm.isHidden(i)) {
+ return;
+ }
+
t.params['csvCols['+i+']'] = c.dataIndex;
t.params['csvTitles['+i+']'] = c.header;
// do it as a post, as args can get long..
- this.method = this.method || 'POST';
+ this.method = 'POST';
if (this.method == 'POST') {
this.params._get = 1;
}