Skip to content

Commit 9803aa3

Browse files
chore: fix the scroll in lwc report
1 parent 52b6b20 commit 9803aa3

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/javascripts/reportGeneratorUtility.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function applySingleColumnFreeze(table, headerCell, columnWidth = 180) {
318318
// Default to 180px for Custom Labels, but can be overridden for other reports
319319

320320
// Apply styles to first header cell
321-
applyStickyStyles(headerCell, columnWidth, 0, 20, '#f3f3f3', true);
321+
applyStickyStyles(headerCell, columnWidth, 0, 50, '#f3f3f3', true);
322322

323323
// Ensure all other header cells in both rows are NOT sticky
324324
const thead = table.querySelector('thead');
@@ -336,17 +336,19 @@ function applySingleColumnFreeze(table, headerCell, columnWidth = 180) {
336336
if (tbody) {
337337
const rows = tbody.querySelectorAll('tr');
338338
rows.forEach((row) => {
339-
const firstCell = row.querySelector('td:first-child');
339+
// Use key="name" selector to handle rowspan correctly
340+
const firstCell = row.querySelector('td[key="name"]');
340341
if (firstCell) {
341-
applyStickyStyles(firstCell, columnWidth, 0, 10, '#fff', true);
342+
applyStickyStyles(firstCell, columnWidth, 0, 30, '#fff', true);
342343
}
343344
});
344345

345346
// Ensure all other columns are NOT sticky
346347
rows.forEach((row) => {
347348
const cells = Array.from(row.querySelectorAll('td'));
348-
cells.forEach((cell, index) => {
349-
if (index > 0) {
349+
cells.forEach((cell) => {
350+
// Remove sticky from any cell that's NOT the name column
351+
if (cell.getAttribute('key') !== 'name') {
350352
removeStickyStyles(cell);
351353
}
352354
});
@@ -355,14 +357,14 @@ function applySingleColumnFreeze(table, headerCell, columnWidth = 180) {
355357
// Add hover effect for first column
356358
rows.forEach((row) => {
357359
row.addEventListener('mouseenter', () => {
358-
const firstCell = row.querySelector('td:first-child');
360+
const firstCell = row.querySelector('td[key="name"]');
359361
if (firstCell) {
360362
firstCell.style.setProperty('background-color', '#f3f3f3', 'important');
361363
}
362364
});
363365

364366
row.addEventListener('mouseleave', () => {
365-
const firstCell = row.querySelector('td:first-child');
367+
const firstCell = row.querySelector('td[key="name"]');
366368
if (firstCell) {
367369
firstCell.style.setProperty('background-color', '#fff', 'important');
368370
}
@@ -419,7 +421,7 @@ function applyMultiColumnHeaderFreeze(firstHeaderCell, secondRow, colspan, baseC
419421
// Freeze this column
420422
const columnWidth = i === 0 ? firstColumnWidth : baseColumnWidth;
421423
const isLastFrozen = i === colspan - 1;
422-
applyStickyStyles(header, columnWidth, cumulativeLeft, 20, '#f3f3f3', isLastFrozen);
424+
applyStickyStyles(header, columnWidth, cumulativeLeft, 50, '#f3f3f3', isLastFrozen);
423425
cumulativeLeft += columnWidth;
424426
} else {
425427
// Ensure non-frozen columns are NOT sticky
@@ -455,7 +457,7 @@ function applyMultiColumnBodyFreeze(tbody, colspan, baseColumnWidth, firstColumn
455457
// Freeze this column
456458
const columnWidth = i === 0 ? firstColumnWidth : baseColumnWidth;
457459
const isLastFrozen = i === colspan - 1;
458-
applyStickyStyles(cell, columnWidth, cumulativeLeft, 10, '#fff', isLastFrozen);
460+
applyStickyStyles(cell, columnWidth, cumulativeLeft, 30, '#fff', isLastFrozen);
459461
cumulativeLeft += columnWidth;
460462
} else {
461463
// Ensure non-frozen columns are NOT sticky

0 commit comments

Comments
 (0)