Skip to content

Commit

Permalink
Increased scope of index variable
Browse files Browse the repository at this point in the history
  • Loading branch information
robGardiner01 committed Apr 30, 2024
1 parent f426a47 commit 75ca5c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3322,6 +3322,7 @@ export class FrozenColumn implements AfterViewInit {
updateStickyPosition() {
if (this._frozen) {
let currentElement = this.el.nativeElement;
let index = DomHandler.index(currentElement);
if (this.alignFrozen === 'right') {
let right = 0;
if (currentElement.nodeName == 'TH') {
Expand All @@ -3330,7 +3331,7 @@ export class FrozenColumn implements AfterViewInit {
right += parseFloat(currentElement.style.minWidth);
}
} else {
let currentElementHeader = currentElement?.parentElement?.parentElement?.previousElementSibling?.firstElementChild?.cells[DomHandler.index(this.el.nativeElement)];
let currentElementHeader = currentElement?.parentElement?.parentElement?.previousElementSibling?.firstElementChild?.cells[index];
right = parseFloat(currentElementHeader.style.right);
}
this.el.nativeElement.style.right = right + 'px';
Expand All @@ -3342,7 +3343,7 @@ export class FrozenColumn implements AfterViewInit {
left += parseFloat(currentElement.style.minWidth);
}
} else {
let currentElementHeader = currentElement?.parentElement?.parentElement?.previousElementSibling?.firstElementChild?.cells[DomHandler.index(this.el.nativeElement)];
let currentElementHeader = currentElement?.parentElement?.parentElement?.previousElementSibling?.firstElementChild?.cells[index];
left = parseFloat(currentElementHeader.style.left);
}
this.el.nativeElement.style.left = left + 'px';
Expand All @@ -3351,7 +3352,6 @@ export class FrozenColumn implements AfterViewInit {
const filterRow = this.el.nativeElement?.parentElement?.nextElementSibling;

if (filterRow) {
let index = DomHandler.index(this.el.nativeElement);
if (filterRow.children && filterRow.children[index]) {
filterRow.children[index].style.left = this.el.nativeElement.style.left;
filterRow.children[index].style.right = this.el.nativeElement.style.right;
Expand Down

0 comments on commit 75ca5c6

Please sign in to comment.