Commit 9928fc8d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Use the method App.saveAs in the grid plugin Export.

parent cb26baf6
......@@ -15,6 +15,13 @@ Ext.define('App.grid.plugin.Export', {
alias: 'plugin.pGridExport',
requires: 'Ext.form.action.StandardSubmit',
/**
* @cfg {String]
* The root to construct the filename when exporting data.
* The file name is built as root.ext where ext is csv, tex or pdf.
*/
fileRoot: undefined,
/**
* @cfg {String}
* The new line separator used in the CSV / LaTeX file.
......@@ -151,9 +158,14 @@ Ext.define('App.grid.plugin.Export', {
"use strict";
var me = this,
data = me.getCmp().toCSV();
App.save("csv", data);
data = me.getCmp().toCSV(),
root = me.fileRoot;
if (root !== undefined) {
App.saveAs(root + ".csv", data);
} else {
App.save("csv", data);
}
},
/**
......@@ -165,9 +177,14 @@ Ext.define('App.grid.plugin.Export', {
"use strict";
var me = this,
data = me.doLaTeX();
App.save("tex", data);
data = me.doLaTeX(),
root = me.fileRoot;
if (root !== undefined) {
App.saveAs(root + ".tex", data);
} else {
App.save("tex", data);
}
},
/**
......
......@@ -2,6 +2,7 @@
try:
response.headers['Content-Type']='application/pdf'
response.headers['Content-Disposition']='attachment;filename="latex2pdf.pdf"'
response.write(data, escape=False)
except:
......
......@@ -45,7 +45,9 @@
// instantiate the grid
Ext.create('App.grid.Panel', {
plugins: ['pGridExport'],
plugins: [{
fileRoot: "report_4",
ptype: "pGridExport"}],
store: cfgStore,
columns: [
{text: "Controller", dataIndex: 'controller', flex: 0.8},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment