Skip to content

Commit

Permalink
fix(platform): virtual scroll should account for popping columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerodonnell89 committed Sep 23, 2024
1 parent ffa12d2 commit 9bee6ee
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BehaviorSubject, filter } from 'rxjs';
import { FDP_TABLE_VIRTUAL_SCROLL_DIRECTIVE, ROW_HEIGHT } from '../constants';
import { TableVirtualScroll } from '../models';
import { TableScrollDispatcherService } from '../services/table-scroll-dispatcher.service';
import { TableService } from '../services/table.service';
import { Table } from '../table';

@Directive({
Expand Down Expand Up @@ -58,6 +59,11 @@ export class TableVirtualScrollDirective extends TableVirtualScroll implements O
/** @hidden */
private readonly _destroyRef = inject(DestroyRef);

/** @hidden */
constructor(readonly _tableService: TableService) {
super();
}

/** @hidden */
ngOnChanges(changes: SimpleChanges): void {
if (!this._table.tableScrollable) {
Expand All @@ -81,7 +87,14 @@ export class TableVirtualScrollDirective extends TableVirtualScroll implements O
return;
}

const rowHeight = this.rowHeight + 1;
let rowHeight = this.rowHeight + 1;

if (this._tableService.poppingColumns$().length > 0) {
rowHeight =
rowHeight +
this._table.tableContainer.nativeElement.getElementsByClassName('fd-table__row--secondary')[0]
.clientHeight;
}

const rowsVisible = this._table._tableRowsVisible;
const currentlyRenderedRows = this._table.getCurrentlyRenderedRows();
Expand Down

0 comments on commit 9bee6ee

Please sign in to comment.