Skip to content

Commit

Permalink
[table] fix: set grid bleed >= numFrozenColumns (#5049)
Browse files Browse the repository at this point in the history
Co-authored-by: Adi Dahiya <adahiya@palantir.com>
  • Loading branch information
mattskrobola and adidahiya authored Feb 9, 2022
1 parent a8d7453 commit 3a1b623
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions packages/table/src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1081,9 +1081,12 @@ export class Table extends AbstractComponent2<TableProps, TableState, TableSnaps

private validateGrid() {
if (this.grid == null) {
const { defaultRowHeight, defaultColumnWidth } = this.props;
const { defaultRowHeight, defaultColumnWidth, numFrozenColumns } = this.props;
const { rowHeights, columnWidths } = this.state;
this.grid = new Grid(rowHeights, columnWidths, Grid.DEFAULT_BLEED, defaultRowHeight, defaultColumnWidth);

// gridBleed should always be >= numFrozenColumns since columnIndexStart adds numFrozenColumns
const gridBleed = Math.max(Grid.DEFAULT_BLEED, numFrozenColumns);
this.grid = new Grid(rowHeights, columnWidths, gridBleed, defaultRowHeight, defaultColumnWidth);
this.invokeOnVisibleCellsChangeCallback(this.state.viewportRect);
this.hotkeysImpl.setGrid(this.grid);
}
Expand Down
7 changes: 5 additions & 2 deletions packages/table/src/table2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,12 @@ export class Table2 extends AbstractComponent2<TableProps, TableState, TableSnap

private validateGrid() {
if (this.grid == null) {
const { defaultRowHeight, defaultColumnWidth } = this.props;
const { defaultRowHeight, defaultColumnWidth, numFrozenColumns } = this.props;
const { rowHeights, columnWidths } = this.state;
this.grid = new Grid(rowHeights, columnWidths, Grid.DEFAULT_BLEED, defaultRowHeight, defaultColumnWidth);

// gridBleed should always be >= numFrozenColumns since columnIndexStart adds numFrozenColumns
const gridBleed = Math.max(Grid.DEFAULT_BLEED, numFrozenColumns);
this.grid = new Grid(rowHeights, columnWidths, gridBleed, defaultRowHeight, defaultColumnWidth);
this.invokeOnVisibleCellsChangeCallback(this.state.viewportRect);
this.hotkeysImpl.setGrid(this.grid);
}
Expand Down

1 comment on commit 3a1b623

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[table] fix: set grid bleed >= numFrozenColumns (#5049)

Previews: documentation | landing | table | modern colors demo

Please sign in to comment.