Skip to content

Commit a9b4194

Browse files
committed
check if median exists
1 parent 2782523 commit a9b4194

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4808,6 +4808,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
48084808
isRollup={isRollup}
48094809
onChange={this.handleAggregationsChange}
48104810
onEdit={this.handleAggregationEdit}
4811+
dh={model.dh}
48114812
/>
48124813
);
48134814
case OptionType.AGGREGATION_EDIT:

packages/iris-grid/src/sidebar/aggregations/Aggregations.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import {
2020
} from '@deephaven/components';
2121
import type { DraggableRenderItemProps, Range } from '@deephaven/components';
2222
import { type ModelIndex } from '@deephaven/grid';
23-
import type AggregationOperation from './AggregationOperation';
23+
import type { dh as DhType } from '@deephaven/jsapi-types';
24+
import AggregationOperation from './AggregationOperation';
2425
import AggregationUtils, { SELECTABLE_OPTIONS } from './AggregationUtils';
2526
import './Aggregations.scss';
2627

@@ -46,22 +47,30 @@ export type AggregationsProps = {
4647
removed: AggregationOperation[]
4748
) => void;
4849
onEdit: (aggregation: Aggregation) => void;
50+
dh: typeof DhType;
4951
};
5052

5153
function Aggregations({
5254
isRollup,
5355
settings,
5456
onChange,
5557
onEdit,
58+
dh,
5659
}: AggregationsProps): JSX.Element {
5760
const { aggregations, showOnTop } = settings;
5861
const options = useMemo(
5962
() =>
6063
SELECTABLE_OPTIONS.filter(
6164
option =>
62-
!aggregations.some(aggregation => aggregation.operation === option)
65+
!aggregations.some(aggregation => aggregation.operation === option) &&
66+
!(
67+
option === AggregationOperation.MEDIAN &&
68+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
69+
// @ts-ignore - MEDIAN is not defined in older version of Core
70+
dh.AggregationOperation.MEDIAN === undefined
71+
)
6372
),
64-
[aggregations]
73+
[aggregations, dh]
6574
);
6675
const [selectedOperation, setSelectedOperation] = useState(options[0]);
6776
const [selectedRanges, setSelectedRanges] = useState<Range[]>([]);

0 commit comments

Comments
 (0)