fix(PivotExcelExport): select correct chart for export (#34793)

(cherry picked from commit e908775fb2)
This commit is contained in:
Mehmet Salih Yavuz
2025-08-21 20:36:29 +03:00
committed by Joe Li
parent ebfddb2b39
commit f0cfd17dc5
3 changed files with 8 additions and 3 deletions

View File

@@ -264,7 +264,7 @@ test('Should export to pivoted Excel if report is pivot table', async () => {
userEvent.click(await screen.findByText('Export to Pivoted Excel'));
expect(props.exportPivotExcel).toHaveBeenCalledTimes(1);
expect(props.exportPivotExcel).toHaveBeenCalledWith(
'.pvtTable',
'#chart-id-371 .pvtTable',
props.slice.slice_name,
);
});

View File

@@ -271,7 +271,11 @@ const SliceHeaderControls = (
break;
}
case MenuKeys.ExportPivotXlsx: {
props.exportPivotExcel?.('.pvtTable', props.slice.slice_name);
const sliceSelector = `#chart-id-${props.slice.slice_id}`;
props.exportPivotExcel?.(
`${sliceSelector} .pvtTable`,
props.slice.slice_name,
);
break;
}
case MenuKeys.CrossFilterScoping: {

View File

@@ -333,8 +333,9 @@ export const useExploreAdditionalActionsMenu = (
icon: <Icons.FileOutlined />,
disabled: !canDownloadCSV,
onClick: () => {
const sliceSelector = `#chart-id-${slice?.slice_id}`;
exportPivotExcel(
'.pvtTable',
`${sliceSelector} .pvtTable`,
slice?.slice_name ?? t('pivoted_xlsx'),
);
setIsDropdownVisible(false);