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

🐛Hidden data are present when exported in CSV, but not the hidden headers #2936

Closed
2 of 5 tasks
fmo-dev opened this issue Oct 23, 2024 · 8 comments
Closed
2 of 5 tasks
Assignees
Labels
✨ supported or fixed in next 在 2.0-next 版本中,已支持该需求,或 bug 已修复

Comments

@fmo-dev
Copy link

fmo-dev commented Oct 23, 2024

🏷 Version

Package Version
@antv/s2 1.53.0
@antv/s2-react 1.45.0

Sheet Type

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Description

If some columns have been hidden in a table and you use the copyData function to prepare a CSV to download from the spreadsheet object, it is generated with :

  • The headers without the hidden headers
  • The data with the hidden data

This results in an incorrect CSV, as there are more data columns than headers

⌨️ Code Snapshots

To export our table, we only use this code snipper

const data = copyData(spreadsheet, ";");
download(data, title)

🔗 Reproduce Link

https://codesandbox.io/p/sandbox/eager-pascal-rxkllp?file=%2Fsrc%2FApp.tsx%3A16%2C23

🤔 Steps to Reproduce

Hide one or many columns by clicking on a header and clicking on "Hide", then try to export the table by clicking on the button above

😊 Expected Behavior

No hidden data should be in the CSV

😅 Current Behavior

The hidden data are in the CSV, but not their header, so their corresponding header on the CSV is the wrong one, and this is the case for any column after that

For example if we have this table

Header1 Header2 Header3
Data1 Data2 Data3

If I hide the second column the table will looks like this

Header1 Header3
Data1 Data3

But if i use the function copyData it will returns this string

"Header1", "Header3",
"Data1", "Data2", "Data3"

Which is incorrect, because converting it to csv would give something similar to the table below

Header1 Header3
Data1 Data2 Data3

💻 System information

Environment Info
System Windows 11
Browser chrome: v130.0.6723.70
@fmo-dev fmo-dev changed the title 🐛Hidden data are present when exported to CSV, but not the hidden headers 🐛Hidden data are present when exported in CSV, but not the hidden headers Oct 23, 2024
@astragier
Copy link

Hi!
We have this bug in production, exporting tables while having some columns hidden result in an invalid CSV file.
Can you please look at this bug??

@lijinke666
Copy link
Member

lijinke666 commented Oct 28, 2024

This was a known issue because there were a lot of copy/export issues, because have break changes in 1.x version, so we completely refactored this part of the logic in version 2.0, which is currently in private beta with a stable release expected next month.

If your project cannot be upgraded to 2.0, you will need to wait for a fix to be released later, or help us build together, submit bugfix patch PR.

@lijinke666
Copy link
Member

Version 2.0 is currently under construction and has only Chinese documentation.

@lijinke666 lijinke666 self-assigned this Oct 28, 2024
@lijinke666 lijinke666 added the ✨ supported or fixed in next 在 2.0-next 版本中,已支持该需求,或 bug 已修复 label Oct 28, 2024
Copy link
Contributor

你好 @fmo-dev,该功能或缺陷已经在 2.0 next 版本 中支持或修复,next 版本目前处于内测中, 感谢你的支持与理解。

如有任何 2.0 版本 问题,请前往讨论区查看文档, 抢先试用:

yarn add @antv/s2@next  # pnpm add @antv/s2@next
yarn add @antv/s2-react@next  # pnpm add @antv/s2-react@next
yarn add @antv/s2-vue@next  # pnpm add @antv/s2-vue@next

Hello, @fmo-dev, This feature or flaw has been supported or fixed in 2.0 next version, next version is currently in private beta, thank you for your support and understanding.

Any 2.0 version issues, please go to discussion, or view docs, the first trial:

@lijinke666
Copy link
Member

ref: #2885

@astragier
Copy link

This was a known issue because there were a lot of copy/export issues, because have break changes in 1.x version, so we completely refactored this part of the logic in version 2.0, which is currently in private beta with a stable release expected next month.

If your project cannot be upgraded to 2.0, you will need to wait for a fix to be released later, or help us build together, submit bugfix patch PR.

Ok we'll wait for the v2 but I hope it would be released next month as you expect. Indeed we are waiting for it since November 2023 when it was announced for end of the year 😅

@lijinke666
Copy link
Member

2.0 stable version is published. see https://s2.antv.antgroup.com/en/manual/migration-v2, other english documentation is WIP.

@fmo-dev
Copy link
Author

fmo-dev commented Nov 21, 2024

Excellent news ! Do you have an idea of when the full english documentation will be available ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ supported or fixed in next 在 2.0-next 版本中,已支持该需求,或 bug 已修复
Projects
None yet
Development

No branches or pull requests

3 participants