X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Pman.Download.js;h=62e845b705b538e49ac07548a74e625f89eb4998;hb=dff7116c31985c523f927df3e8e7cf50670ef428;hp=9dba6b41856d95c31ff55f9727c9d5c12d028dc4;hpb=0b4f996ab1addf59265a29752045c08b2177260a;p=Pman.Core diff --git a/Pman.Download.js b/Pman.Download.js index 9dba6b41..62e845b7 100644 --- a/Pman.Download.js +++ b/Pman.Download.js @@ -23,10 +23,10 @@ var t = new Pman.Download({ * @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).. @@ -110,7 +110,8 @@ Pman.Download = function(cfg) // }); // } - 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]); /* @@ -128,7 +129,8 @@ Pman.Download = function(cfg) } 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 ) @@ -161,7 +163,9 @@ Pman.Download = function(cfg) } } - + if (this.showDownloading) { + Roo.MessageBox.alert("Downloading", "The file should download shortly"); + } req.send(this.form); /* (function() { @@ -194,6 +198,9 @@ Roo.apply(Pman.Download.prototype, { success : false, failure : false, + hiddenCols : 'show', // set to 'hide' to hide them.. + + showDownloading : false, // private.. //used by simple GET method. createCsvFrame: function() @@ -326,6 +333,11 @@ Roo.apply(Pman.Download.prototype, { } 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; @@ -338,7 +350,7 @@ Roo.apply(Pman.Download.prototype, { // 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; }