Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable csv export fails in chrome but is working in IE #1098

Closed
JEEVANJGA opened this issue Nov 27, 2019 · 4 comments
Closed

DataTable csv export fails in chrome but is working in IE #1098

JEEVANJGA opened this issue Nov 27, 2019 · 4 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@JEEVANJGA
Copy link

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request

Current behavior
application built using this library is working fine during serve at local in chrome as well as in IE. But when the built files are deployed to the required site location, csv export feature is triggering a url transition and is getting stuck over there with 404 Not found error.
image

Expected behavior
On click of Csv export button download required file to the system from Chrome/IE browser.

Please tell us about your environment:

Operating system : Windows 10
IDE : VS Code
package manager : npm
Framework used to develop the application : SPFX with React for SharePoint Online WebPart development.

  • React version:
    "react": "16.8.5",

  • PrimeReact version:
    "primereact": "^3.3.2",

  • Browser: [Chrome 78.0.3904.108 ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
@JEEVANJGA
Copy link
Author

@mertsincan could you please take a look on this as well.

issue still persist for the new version : 3.3.3

JEEVANJGA referenced this issue Dec 6, 2019
Fixed #433, Update DataTable.js to fix IE csv filename export
@JEEVANJGA
Copy link
Author

Found out a work around to make the else part that handles download in chrome browser to make work.

Replaced following code inside the else part :

const data = window.URL.createObjectURL(blob);
          var link = document.createElement('a');
          link.href = data;
          link.download = this.props.exportFilename + '.csv';
          link.click();
          setTimeout(function () {
            // For Firefox it is necessary to delay revoking the ObjectURL
            window.URL.revokeObjectURL(data);
          }, 100);

This change in the DataTable.js file worked as expected in the built application.

@jclementEIT
Copy link

@JEEVANJGA Did you ever bring this into the main code? I'm still seeing this issue in Firefox and Chrome inside Sharepoint.

@mertsincan mertsincan self-assigned this Feb 9, 2021
@mertsincan mertsincan added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Feb 9, 2021
@mertsincan mertsincan added this to the 6.1.0 milestone Feb 9, 2021
@mertsincan mertsincan added Type: Bug Issue contains a defect related to a specific component. and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Mar 9, 2021
@mertsincan
Copy link
Member

Hi,

I couldn't replicate this issue but, I made some changes based on https://stackoverflow.com/a/38389976

If the problem persists, please reopen this issue.

Best Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants