-
Notifications
You must be signed in to change notification settings - Fork 6
remove calculation data from spreadsheet copy #4160
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
75bb370
de35f10
7b6e9d7
130ea88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -78,10 +78,21 @@ export default function SaveSpreadsheetButton({ | |||||
|
|
||||||
| const getCsvProps = useCallback( | ||||||
| (csvCase: SpreadsheetSaveOptionId.COPY_CSV | SpreadsheetSaveOptionId.EXPORT_CSV) => { | ||||||
| const gridCsvFunction = | ||||||
| csvCase === SpreadsheetSaveOptionId.COPY_CSV | ||||||
| ? gridRef.current?.api.getDataAsCsv | ||||||
| : gridRef.current?.api.exportDataAsCsv; | ||||||
| const isCopy = csvCase === SpreadsheetSaveOptionId.COPY_CSV; | ||||||
| const gridCsvFunction = (params?: any) => { | ||||||
| const exportParams = { | ||||||
| ...params, | ||||||
| shouldRowBeSkipped: (rowParams: any) => { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (owParams: ShouldRowBeSkippedParams) |
||||||
| const rowData: { rowType?: string } = rowParams.node?.data; | ||||||
| // remove lines used to calculate | ||||||
| return rowData?.rowType?.includes('calculation'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
and "includes" works but I think it would be cleaner and more long time effective to create a specific utility function like : |
||||||
| }, | ||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||
| }; | ||||||
|
|
||||||
| return isCopy | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't need to define cont varaiable isCopy, you can used directly like
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True but I think this is clearer to avoid big ternaries. |
||||||
| ? gridRef.current?.api.getDataAsCsv(exportParams) | ||||||
| : gridRef.current?.api.exportDataAsCsv(exportParams); | ||||||
| }; | ||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||
| if (!gridCsvFunction) { | ||||||
| console.error('Csv API is not available.'); | ||||||
| return; | ||||||
|
Comment on lines
96
to
98
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will never happen again because now in your code gridCsvFunction is never undefined (even if it may return undefined). The test should be updated to really test the api availability. |
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess the type here (params?: ValueGetterParams)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
CsvExportParams.