Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5cc12f

Browse files
committed
fix: alignment issue without checkbox column
1 parent 4758cf2 commit a5cc12f

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/cellmanager.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -808,20 +808,29 @@ export default class CellManager {
808808

809809
const isBodyCell = !(isHeader || isFilter || isTotalRow);
810810

811+
const serialNoColIndex = !this.options.checkboxColumn && this.options.serialNoColumn ? 0 : 1;
812+
811813
let sticky = false;
812814

813815
if (colIndex === 0 && this.options.checkboxColumn) {
814-
this.stickyRowWidth = 33;
816+
if (cell.isHeader && !(cell.id in this.stickyColWitdh)) this.stickyRowWidth = 33;
815817
sticky = true;
816-
} else if (colIndex === 1 && this.options.serialNoColumn) {
817-
styles = `left:${this.stickyRowWidth}px;`;
818-
this.stickyRowWidth += 36;
818+
} else if (colIndex === serialNoColIndex && this.options.serialNoColumn) {
819+
if (cell.isHeader && !(cell.id in this.stickyColWitdh)) {
820+
this.stickyColWitdh[cell.id] = this.stickyRowWidth;
821+
this.stickyRowWidth += (cell.width || 32);
822+
}
823+
styles = `left:${this.stickyColWitdh[isBodyCell ? cell.column.id : cell.id]}px;`;
819824
sticky = true;
825+
820826
} else if (cell.sticky) {
821-
styles = `left:${this.stickyRowWidth}px;`;
822-
this.stickyColWitdh[cell.id] = this.stickyRowWidth;
823-
this.stickyRowWidth += (cell.width || 100);
827+
if (cell.isHeader && !(cell.id in this.stickyColWitdh)) {
828+
this.stickyColWitdh[cell.id] = this.stickyRowWidth;
829+
this.stickyRowWidth += (cell.width || 100);
830+
}
831+
styles = `left:${this.stickyColWitdh[cell.id]}px;`;
824832
sticky = true;
833+
825834
} else if (isBodyCell && cell.column.sticky) {
826835
styles = `left:${this.stickyColWitdh[cell.column.id]}px;`;
827836
sticky = true;

0 commit comments

Comments
 (0)