Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions packages/iris-grid/src/IrisGridTableModelTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ class IrisGridTableModelTemplate<

private _columnHeaderGroups: ColumnHeaderGroup[] = [];

private _isColumnHeaderGroupsInitialized = false;

private _movedColumns: MoveOperation[] | null = null;

/**
Expand Down Expand Up @@ -224,11 +226,6 @@ class IrisGridTableModelTemplate<
// These rows can be sparse, so using a map instead of an array.
this.pendingNewDataMap = new Map();
this.pendingNewRowCount = 0;

this.columnHeaderGroups = IrisGridUtils.parseColumnHeaderGroups(
this,
this.layoutHints?.columnGroups ?? []
).groups;
}

close(): void {
Expand Down Expand Up @@ -926,10 +923,12 @@ class IrisGridTableModelTemplate<
}

get columnHeaderGroupMap(): Map<string, ColumnHeaderGroup> {
this.initializeColumnHeaderGroups();
return this._columnHeaderGroupMap;
}

get columnHeaderGroups(): ColumnHeaderGroup[] {
this.initializeColumnHeaderGroups();
return this._columnHeaderGroups;
}

Expand All @@ -952,6 +951,16 @@ class IrisGridTableModelTemplate<
this.columnHeaderMaxDepth = maxDepth;
this.columnHeaderParentMap = parentMap;
this._columnHeaderGroupMap = groupMap;
this._isColumnHeaderGroupsInitialized = true;
}

private initializeColumnHeaderGroups(): void {
if (!this._isColumnHeaderGroupsInitialized) {
this.columnHeaderGroups = IrisGridUtils.parseColumnHeaderGroups(
this,
this.layoutHints?.columnGroups ?? []
).groups;
}
}

row(y: ModelIndex): R | null {
Expand Down
6 changes: 6 additions & 0 deletions packages/iris-grid/src/IrisGridTreeTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ class IrisGridTreeTableModel extends IrisGridTableModelTemplate<
return [this.virtualColumns.length, this.groupedColumns.length];
}

get layoutHints(): DhType.LayoutHints | null | undefined {
// TODO: Update this when JS API types are updated with this.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (this.table as any).layoutHints;
Comment thread
mofojed marked this conversation as resolved.
Outdated
}

get hasExpandableRows(): boolean {
return true;
}
Expand Down