Skip to content

Commit 8407e4c

Browse files
authored
fix: DH-19601: Pin aggregations to the top in input tables (#2502)
For DH-19601. Input tables with aggregations in the footer were experiencing conflicts between aggregated data and insertions to the pending area. This pr pins aggregations to the top of input tables, that way we have the bottom of the table reserved for pending rows, and we don't need to worry about conflicts.
1 parent cdd64d2 commit 8407e4c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
863863

864864
rollupConfig,
865865
rollupSelectedColumns: [],
866-
aggregationSettings,
866+
aggregationSettings:
867+
// Pin aggregations to the top if the grid is editable, so that the bottom is reserved for pending rows
868+
isEditableGridModel(model) && model.isEditable
869+
? { ...aggregationSettings, showOnTop: true }
870+
: aggregationSettings,
867871
selectedAggregation: null,
868872

869873
openOptions: [],
@@ -4833,6 +4837,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
48334837
<Aggregations
48344838
settings={aggregationSettings}
48354839
isRollup={isRollup}
4840+
availablePlacements={
4841+
isEditableGridModel(model) && model.isEditable
4842+
? ['top']
4843+
: ['top', 'bottom']
4844+
}
48364845
onChange={this.handleAggregationsChange}
48374846
onEdit={this.handleAggregationEdit}
48384847
dh={model.dh}

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export type AggregationSettings = {
4040

4141
export type AggregationsProps = {
4242
isRollup: boolean;
43+
availablePlacements?: ('top' | 'bottom')[];
4344
settings: AggregationSettings;
4445
onChange: (
4546
settings: AggregationSettings,
@@ -53,6 +54,7 @@ export type AggregationsProps = {
5354
function Aggregations({
5455
isRollup,
5556
settings,
57+
availablePlacements = ['top', 'bottom'],
5658
onChange,
5759
onEdit,
5860
dh,
@@ -308,8 +310,18 @@ function Aggregations({
308310
onChange={handleShowOnTopChange}
309311
value={`${showOnTop}`}
310312
>
311-
<Radio value="true">Top</Radio>
312-
<Radio value="false">Bottom</Radio>
313+
<Radio
314+
value="true"
315+
isDisabled={!availablePlacements.includes('top')}
316+
>
317+
Top
318+
</Radio>
319+
<Radio
320+
value="false"
321+
isDisabled={!availablePlacements.includes('bottom')}
322+
>
323+
Bottom
324+
</Radio>
313325
</RadioGroup>
314326
</div>
315327
)}

0 commit comments

Comments
 (0)