Skip to content

Commit

Permalink
fix: Freezing a tree table column crashes the panel (#1192)
Browse files Browse the repository at this point in the history
Fixes #1136 

Column is only freezable when the table is not a tree table.

Reset `frozenColumns` on rollup change.
  • Loading branch information
emilyhuxng authored Apr 6, 2023
1 parent d8db9ca commit 5142a4d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/iris-grid/src/IrisGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3198,6 +3198,7 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
this.setState({
rollupConfig,
movedColumns: [],
frozenColumns: [],
sorts: [],
reverseType: TableUtils.REVERSE_TYPE.NONE,
selectDistinctColumns: [],
Expand Down
8 changes: 7 additions & 1 deletion packages/iris-grid/src/IrisGridTreeTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import memoize from 'memoize-one';
import { GridRange, ModelIndex } from '@deephaven/grid';
import { Column, TreeRow, TreeTable } from '@deephaven/jsapi-shim';
import { assertNotNull } from '@deephaven/utils';
import { UIRow } from './CommonTypes';
import { UIRow, ColumnName } from './CommonTypes';
import IrisGridTableModelTemplate from './IrisGridTableModelTemplate';

export interface UITreeRow extends UIRow {
Expand Down Expand Up @@ -182,6 +182,12 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
)
)
);

updateFrozenColumns(columns: ColumnName[]): void {
if (columns.length > 0) {
throw new Error('Cannot freeze columns on a tree table');
}
}
}

export default IrisGridTreeTableModel;
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
columnWidth => columnWidth === 0
);
const isColumnFreezable =
model.getColumnHeaderParentGroup(modelIndex, 0) === undefined;
model.getColumnHeaderParentGroup(modelIndex, 0) === undefined &&
!(isExpandableGridModel(model) && model.hasExpandableRows);
const isColumnFrozen = model.isColumnFrozen(modelIndex);
actions.push({
title: 'Hide Column',
Expand Down

0 comments on commit 5142a4d

Please sign in to comment.