hi :
I made some export by phantomjs :
this is code :
$.each(liste_report, function(index, val) {
try{
report = jQuery.parseJSON(val['report']);
var pivot;
pivot = new Flexmonster({
licenseKey: licenceKey,
container: "#pivotContainer",
componentFolder: "http://localhost/projet_phantomjs/flexmonster2710/",
customizeCell: customizeCellFunction,
report: report,
reportcomplete: function() {
pivot.off("reportcomplete");
generateExcel(pivot, val['id_client'], val['id_report']);
},
exportcomplete: function() {
pivot.off("exportcomplete");
generateExcel(pivot, val['id_client'], val['id_report']);
}
});
} catch (error) {
console.error(error);
}
});
function generateExcel(pivot_r, id_client, id_report) {
var today = new Date();
var name_date = today.getFullYear() + "_" + (today.getMonth() + 1) + "_" + today.getDate();
var params = {
filename : 'export_' + id_client + "_" + name_date + '_' + id_report + '.xlsx',
destinationType : 'server',
url : 'http://localhost/projet_phantomjs/public/save.php?id_client=' + id_client + '&id_report=' + id_report
};
pivot_r.exportTo('Excel', params);
}
I managed to create the files, but there is a problem about title .
Except the last file, the title of all the other files have a backgrounde color black.
it's very bizzare !
thanks a lot !
Hello,
Thank you for writing to us.
We would like to bring to your attention that the export function is asynchronous.
Please consider one of the suggested approaches:
1) Render Flexmonster to different containers
2) Postpone the next new Flexmonster call until the first one (current) is finished.
We have also noticed that different variables are used for the report’s id: val['id_report']
and val['idreport']
.
Please let us know if this helps to resolve the issue.
Best Regards,
Vera
thanks a lot for your reponse, but it's not him the probleme !
Hello,
Thank you for your reply.
Could you please provide more details on why you are generating the Excel twice: on reportcomplete
and on exportcomplete
?
Waiting for your response.
Best Regards,
Vera
Hi:
oh, because I did not find the problem, so i take a try, but even we delete exportcomplet, there is always this problem.
Like this :
$.each(liste_report, function(index, val) {
try{
report = jQuery.parseJSON(val['report']);
var pivot;
pivot = new Flexmonster({
licenseKey: licenceKey,
container: "#pivotContainer",
componentFolder: "http://localhost/projet_phantomjs/flexmonster2710/",
customizeCell: customizeCellFunction,
report: report,
reportcomplete: function() {
pivot.off("reportcomplete");
generateExcel(pivot, val['id_client'], val['id_report']);
}
});
} catch (error) {
console.error(error);
}
});
function generateExcel(pivot_r, id_client, id_report) {
var today = new Date();
var name_date = today.getFullYear() + "_" + (today.getMonth() + 1) + "_" + today.getDate();
var params = {
filename : 'export_' + id_client + "_" + name_date + '_' + id_report + '.xlsx',
destinationType : 'server',
url : 'http://localhost/projet_phantomjs/public/save.php?id_client=' + id_client + '&id_report=' + id_report
};
pivot_r.exportTo('Excel', params);
}
messages additional :
at the end, there are this messages errors,
TypeError: null is not an object (evaluating 'this.svg[V58.f8b][V58.f8b].getBBox')
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in update
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in Wc
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in aX
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in La
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in La
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in Rf
file:///home/prod/cti/stats/flex/flexmonster2710/flexmonster.js:9 in r3n
Hello,
Thank you for the details.
We think that the cause of the issue is the each
loop, because it may override Flexmonster instance inside #pivotContainer
before previous export is completed. So, we recommend running export one by one. Please refer to the attached sample, that works as expected for multiple reports.
Please let us know if it works.
Regards,
Ian
Hi Ian Sadovy :
thank you for your help, i will try it !
Hi Vera Didenko and Ian Sadovy,
The problem is solved, thank you very much !