Skip to content

Commit

Permalink
fix: DH-17199: Filter by value in the tree table context menu always …
Browse files Browse the repository at this point in the history
…shows null (#2078)

Provide an initializer for the optional `formatValue` argument in
`IrisGridTreeTableModel` `snapshot` method.
Remove the conditional that caused the `resultRow` to be an empty array
when the `formatValue` argument isn't provided.
  • Loading branch information
vbabich authored Jun 13, 2024
1 parent 640e002 commit 4eb38dd
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/iris-grid/src/IrisGridTreeTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
async snapshot(
ranges: GridRange[],
includeHeaders?: boolean,
formatValue?: (value: unknown, column: DhType.Column) => unknown
formatValue: (value: unknown, column: DhType.Column) => unknown = value =>
value
): Promise<unknown[][]> {
assertNotNull(this.viewport);
assertNotNull(this.viewportData);
Expand Down Expand Up @@ -185,16 +186,14 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
this.viewportData.rows[r - this.viewportData.offset];
assertNotNull(intersection.startColumn);
assertNotNull(intersection.endColumn);
if (formatValue != null) {
for (
let c = intersection.startColumn;
c <= intersection.endColumn;
c += 1
) {
resultRow.push(
formatValue(viewportRow.data.get(c)?.value, this.columns[c])
);
}
for (
let c = intersection.startColumn;
c <= intersection.endColumn;
c += 1
) {
resultRow.push(
formatValue(viewportRow.data.get(c)?.value, this.columns[c])
);
}
result.push(resultRow);
}
Expand Down

0 comments on commit 4eb38dd

Please sign in to comment.