Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {

Copy link
Copy Markdown
Contributor

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)

const exportParams = {
...params,
shouldRowBeSkipped: (rowParams: any) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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');
},
};

return isCopy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
csvCase === SpreadsheetSaveOptionId.COPY_CSV ?
gridRef.current?.api.getDataAsCsv(exportParams)
: gridRef.current?.api.exportDataAsCsv(exportParams);

? gridRef.current?.api.getDataAsCsv(exportParams)
: gridRef.current?.api.exportDataAsCsv(exportParams);
};
if (!gridCsvFunction) {
console.error('Csv API is not available.');
return;
Expand Down
Loading