mirror of
https://github.com/apache/superset.git
synced 2026-04-22 01:24:43 +00:00
feat(Chart): Save Chart State globally (#35343)
This commit is contained in:
@@ -82,6 +82,8 @@ export default function TableChart<D extends DataRecord = DataRecord>(
|
||||
columnColorFormatters,
|
||||
basicColorFormatters,
|
||||
width,
|
||||
onChartStateChange,
|
||||
chartState,
|
||||
} = props;
|
||||
|
||||
const [searchOptions, setSearchOptions] = useState<SearchOption[]>([]);
|
||||
@@ -110,6 +112,15 @@ export default function TableChart<D extends DataRecord = DataRecord>(
|
||||
comparisonColumns?.[0]?.key,
|
||||
]);
|
||||
|
||||
const handleColumnStateChange = useCallback(
|
||||
agGridState => {
|
||||
if (onChartStateChange) {
|
||||
onChartStateChange(agGridState);
|
||||
}
|
||||
},
|
||||
[onChartStateChange],
|
||||
);
|
||||
|
||||
const filteredColumns = useMemo(() => {
|
||||
if (!isUsingTimeComparison) {
|
||||
return columns;
|
||||
@@ -289,6 +300,8 @@ export default function TableChart<D extends DataRecord = DataRecord>(
|
||||
cleanedTotals={totals || {}}
|
||||
showTotals={showTotals}
|
||||
width={width}
|
||||
onColumnStateChange={handleColumnStateChange}
|
||||
chartState={chartState}
|
||||
/>
|
||||
</StyledChartContainer>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user