Skip to content

Commit afdb592

Browse files
authored
fix: DH-20734: Datetime tooltip shown on wrong column when column is moved (#2554)
- Raw grid indices instead of model indices were being passed to `IrisGridTableModelTemplate.tooltipForCell()`, causing tooltips for a column to be shown in the wrong column if that column is moved Test snippet (any table with a datetime column) ```python import deephaven.plot.express as dx my_table = dx.data.stocks() ```
1 parent 774c4cc commit afdb592

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/iris-grid/src/IrisGridModel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
type GridCell,
88
GridModel,
99
type GridRange,
10-
type GridRangeIndex,
1110
type GridThemeType,
1211
type ModelIndex,
1312
type MoveOperation,
@@ -644,7 +643,7 @@ abstract class IrisGridModel<
644643
throw new Error('Method not implemented.');
645644
}
646645

647-
tooltipForCell(column: GridRangeIndex, row: GridRangeIndex): string | null {
646+
tooltipForCell(column: ModelIndex, row: ModelIndex): string | null {
648647
return null;
649648
}
650649
}

packages/iris-grid/src/IrisGridTableModelTemplate.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
type EditableGridModel,
88
type EditOperation,
99
GridRange,
10-
type GridRangeIndex,
1110
GridUtils,
1211
memoizeClear,
1312
type ModelIndex,
@@ -685,8 +684,7 @@ class IrisGridTableModelTemplate<
685684
return null;
686685
}
687686

688-
tooltipForCell(column: GridRangeIndex, row: GridRangeIndex): string | null {
689-
if (column === null || row === null) return null;
687+
tooltipForCell(column: ModelIndex, row: ModelIndex): string | null {
690688
if (TableUtils.isDateType(this.columns[column].type)) {
691689
return this.displayString(
692690
this.valueForCell(column, row),

packages/iris-grid/src/mousehandlers/IrisGridTokenMouseHandler.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ class IrisGridTokenMouseHandler extends GridTokenMouseHandler {
4141
onMove(gridPoint: GridPoint, grid: Grid): EventHandlerResult {
4242
const { model } = this.irisGrid.props;
4343
const isUserHoveringLink = this.isHoveringLink(gridPoint, grid);
44-
const tooltip = model.tooltipForCell(gridPoint.column, gridPoint.row);
44+
const modelColumn = this.irisGrid.getModelColumn(gridPoint.column);
45+
const modelRow = this.irisGrid.getModelRow(gridPoint.row);
46+
const tooltip =
47+
modelColumn != null && modelRow != null
48+
? model.tooltipForCell(modelColumn, modelRow)
49+
: null;
4550

4651
if (
4752
isUserHoveringLink &&

0 commit comments

Comments
 (0)