question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError happened on export CSV after js file compression

See original GitHub issue

I was working on a function that export to CSV only selected rows. It went well until I tried to compress my js file. I used several plugins including gulp-minify, gulp-uglify, closure compiler and all got same error:

Uncaught TypeError: c.getSelected is not a function
    at Object.c.handleExportCSV [as onExport] (default.js:956)
    at onClick (default.js:981)
    at Object.y (default.js:70)
    at x (default.js:70)
    at v (default.js:71)
    at t (default.js:72)
    at c (default.js:73)
    at z (default.js:73)
    at d (default.js:72)
    at C (default.js:74)

And this is my code:

const columns = [{
          dataField: 'id',
          text: 'Category ID'
        }, {
          dataField: 'name',
          text: 'Category Name'
        }];

        const selectRow = {
          mode: 'checkbox',
          clickToSelect: true
        };

        const { ExportCSVButton } = CSVExport;

        return(
            <ToolkitProvider
              keyField="id"
              data={ this.state.categories }
              columns={ columns }
              exportCSV={ {**onlyExportSelection: true**} }>
              {
                props => (
                  <div>
                    <ExportCSVButton { ...props.csvProps }>Export CSV!!</ExportCSVButton>
                    <hr />
                    <BootstrapTable
                      { ...props.baseProps }
                      selectRow={ selectRow }
                    />
                  </div>
                )
              }
            </ToolkitProvider>
        );

After it, I also tried setting ‘exportAll: false’ instead of ‘onlyExportSelection: true’. Still got an error:

Uncaught TypeError: l.getData is not a function
    at l.handleExportCSV (product.bundle-min.js:1)
    at onClick (product.bundle-min.js:1)
    at Object.<anonymous> (product.bundle-min.js:1)
    at d (product.bundle-min.js:1)
    at product.bundle-min.js:1
    at C (product.bundle-min.js:1)
    at k (product.bundle-min.js:1)
    at j (product.bundle-min.js:1)
    at S (product.bundle-min.js:1)
    at R (product.bundle-min.js:1)

I wonder that is there any mistake or potential name conflict error in your source code? Could you check it out? Thank you so much!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kmb266commented, Oct 26, 2018

Any update on this issue? Thanks!

1reaction
AllenFangcommented, Oct 24, 2018

I will look into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript to csv export encoding issue - Stack Overflow
@Boltosaurus, I created a demo here: jsfiddle.net/8qPur. It looks OK to me : the downloaded file has the special characters encoded correctly. –...
Read more >
Pandas to_csv() - Convert DataFrame to CSV - DigitalOcean
Pandas DataFrame to_csv() function converts DataFrame into CSV data. We can pass a file object to write the CSV data into a file....
Read more >
IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
Return TextFileReader object for iteration. See iterating and chunking below. Quoting, compression, and file format#. compression{ ' ...
Read more >
exceljs - npm
Read, manipulate and write spreadsheet data and styles to XLSX and JSON. Reverse engineered from Excel spreadsheet files as a project.
Read more >
NetSuite Applications Suite - CSV Imports Overview
Editing the CustomConfiguration.js File · Optional Settings in CustomConfiguration.js ... Managing SuiteCloud Projects as Compressed Files in SuiteCloud IDE ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found