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

Title is merged with the first header in the latest version #93

Closed
aditptr opened this issue Mar 6, 2024 · 1 comment · Fixed by #94
Closed

Title is merged with the first header in the latest version #93

aditptr opened this issue Mar 6, 2024 · 1 comment · Fixed by #94
Labels

Comments

@aditptr
Copy link

aditptr commented Mar 6, 2024

Describe the bug
The title and header are merged in the latest version.
this is my logic when using the latest version in angular project:

handleDownloadCsv() {
    // handle the export to csv
    const options: ConfigOptions = {
      filename: `TestCSV_${new Date().toLocaleString().replace(' ', '_')}`,
      fieldSeparator: ',',
      quoteStrings: true,
      decimalSeparator: '.',
      // showLabels: true,
      showTitle: true,
      title: 'TEST TITLE',
      useTextFile: false,
      useBom: true,
      useKeysAsHeaders: true,
    };
    const csvConfig = mkConfig(options);

    const csvData: CsvResultItem[] = this.exportProperties.map((data) => ({
      [this.translate.onTranslating('Property_Name')]: data.name || '',
      [this.translate.onTranslating('Total_Lock(s)')]: data.totalLock || '',
      [this.translate.onTranslating('Total_Department(s)')]:
        data.departmentCount || '',
      [this.translate.onTranslating('Location')]: data.country || '',
    }));
    const csvOutput = generateCsv(csvConfig)(csvData);
    download(csvConfig)(csvOutput);
  }

Current title behavior
image

Expected behavior
In version 0.2.1, the CSV title will be positioned above the first header, as shown in the picture below.
image

  • Browser: Chrome
  • Version ^1.2.3
@aditptr aditptr added the bug label Mar 6, 2024
alexcaza added a commit that referenced this issue Mar 7, 2024
@alexcaza alexcaza mentioned this issue Mar 7, 2024
alexcaza added a commit that referenced this issue Mar 7, 2024
* Fix issue #93

* Bump version
@alexcaza
Copy link
Owner

alexcaza commented Mar 7, 2024

Thanks for catching this! I merged in a fix (PR #94) and published v1.2.4 on npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants