Export to excel is not working properly and it is bring code instead of data.
we are following the examples in the flexmonster page (https://jsfiddle.net/flexmonster/05x4e2pm/) and even in this example that functionality is not working as we can see in the print screen.
In this page if you try to export to excel it will not work and the excel will be generate with code instead data inside.
One thing that we have noted is that if we comment line 32 in JavaScript + JQuery 3.4.1 the export works fine.
Hello,
Thank you for reaching out to us.
Kindly note that this behavior occurs when using the customizeCell
function. To display data correctly, we recommend setting the useCustomizeCellForData
to false
in the exportTo
API call:
function exportToExcel() {
pivot.exportTo('excel', {useCustomizeCellForData: false});
}
To add this functionality to the Toolbar, you can use the beforetoolbarcreated
event:
new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
beforetoolbarcreated: customizeToolbar,
// other properties
});
function customizeToolbar(toolbar) {
let tabs = toolbar.getTabs();
toolbar.getTabs = function() {
let exportTab = tabs.find(tab => tab.id == "fm-tab-export");
if (!exportTab) return tabs;
let exportToPdfTab = exportTab.menu.find(tab => tab.id == "fm-tab-export-excel");
exportToPdfTab.handler = exportToExcel;
return tabs;
}
}
More details on how to customize the Toolbar can be found in our documentation: https://www.flexmonster.com/doc/customizing-toolbar/.
You are welcome to check the following example for reference: https://jsfiddle.net/flexmonster/cero148f/
Please let us know if it works for you. Looking forward to hearing from you.
Kind regards,
Nadia
Hello Jose,
Hope you are doing well.
We were wondering if you had a chance to check the suggested approach. Could you please confirm if it works for you?
Looking forward to hearing your feedback.
Kind regards,
Nadia
Hi Nadia,
it worked very well.
Thank you!
Best regards!
Hello Jose,
Thank you for the feedback.
We are glad to hear that it works for you.
As always, do not hesitate to contact us in case other questions arise.
Kind regards,
Nadia