Skip to content

Commit eccb137

Browse files
committed
fix: change width calculation method
1 parent 63d3413 commit eccb137

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/style.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ export default class Style {
386386
let normalOffset = 0;
387387

388388
this.datamanager.getColumns().forEach((column) => {
389+
const $headerCell = this.getColumnHeaderElement(column.colIndex);
390+
const renderedWidth = $headerCell ? $headerCell.offsetWidth : column.width;
391+
389392
if (column.sticky) {
390393
const selector = `.dt-cell--col-${column.colIndex}.dt-cell--sticky`;
391394
const style = {
@@ -394,11 +397,12 @@ export default class Style {
394397

395398
column.stickyLeft = stickyOffset;
396399
column.stickyScrollTrigger = normalOffset - stickyOffset;
400+
column.renderedWidth = renderedWidth;
397401
this.setStyle(selector, style);
398402
stickySelectors.push(selector);
399-
stickyOffset += column.width;
403+
stickyOffset += renderedWidth;
400404
}
401-
normalOffset += column.width;
405+
normalOffset += renderedWidth;
402406
});
403407

404408
const staleSelectors = (this._stickySelectors || [])

0 commit comments

Comments
 (0)