Skip to content

Commit

Permalink
fix issue with horizontal renderer when only frozen columns are included
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Jan 19, 2025
1 parent a488466 commit 000373b
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 49 deletions.
36 changes: 20 additions & 16 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Tabulator v6.3.0 (c) Oliver Folkerd 2024 */
/* Tabulator v6.3.0 (c) Oliver Folkerd 2025 */
class CoreFeature{

constructor(table){
Expand Down Expand Up @@ -23735,7 +23735,7 @@ class VirtualDomHorizontal extends Renderer{
if(column.visible){
if(!column.modules.frozen){
width = column.getWidth();

config.leftPos = colPos;
config.rightPos = colPos + width;

Expand Down Expand Up @@ -23793,7 +23793,7 @@ class VirtualDomHorizontal extends Renderer{
rowFrag.appendChild(cell.getElement());
});
row.element.appendChild(rowFrag);

row.cells.forEach((cell) => {
cell.cellRendered();
});
Expand All @@ -23806,7 +23806,11 @@ class VirtualDomHorizontal extends Renderer{

reinitializeColumnWidths(columns){
for(let i = this.leftCol; i <= this.rightCol; i++){
this.columns[i].reinitializeWidth();
let col = this.columns[i];

if(col){
col.reinitializeWidth();
}
}
}

Expand Down Expand Up @@ -23894,11 +23898,11 @@ class VirtualDomHorizontal extends Renderer{
reinitializeRows(){
var visibleRows = this.getVisibleRows(),
otherRows = this.table.rowManager.getRows().filter(row => !visibleRows.includes(row));

visibleRows.forEach((row) => {
this.reinitializeRow(row, true);
});

otherRows.forEach((row) =>{
row.deinitialize();
});
Expand Down Expand Up @@ -23945,7 +23949,7 @@ class VirtualDomHorizontal extends Renderer{
working = true;

while(working){

let column = this.columns[this.rightCol + 1];

if(column){
Expand All @@ -23963,7 +23967,7 @@ class VirtualDomHorizontal extends Renderer{
this.fitDataColActualWidthCheck(column);

this.rightCol++; // Don't move this below the >= check below

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.rightCol = this.rightCol;
Expand Down Expand Up @@ -24008,7 +24012,7 @@ class VirtualDomHorizontal extends Renderer{
});

this.leftCol--; // don't move this below the <= check below

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.leftCol = this.leftCol;
Expand Down Expand Up @@ -24066,7 +24070,7 @@ class VirtualDomHorizontal extends Renderer{

this.vDomPadRight += column.getWidth();
this.rightCol --;

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.rightCol = this.rightCol;
Expand All @@ -24088,7 +24092,7 @@ class VirtualDomHorizontal extends Renderer{
removeColLeft(){
var changes = false,
working = true;

while(working){
let column = this.columns[this.leftCol];

Expand All @@ -24110,7 +24114,7 @@ class VirtualDomHorizontal extends Renderer{

this.vDomPadLeft += column.getWidth();
this.leftCol ++;

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.leftCol = this.leftCol;
Expand Down Expand Up @@ -24156,17 +24160,17 @@ class VirtualDomHorizontal extends Renderer{
leftCol:this.leftCol,
rightCol:this.rightCol,
};

if(this.table.modules.frozenColumns){
this.table.modules.frozenColumns.leftColumns.forEach((column) => {
this.appendCell(row, column);
});
}

for(let i = this.leftCol; i <= this.rightCol; i++){
this.appendCell(row, this.columns[i]);
}

if(this.table.modules.frozenColumns){
this.table.modules.frozenColumns.rightColumns.forEach((column) => {
this.appendCell(row, column);
Expand All @@ -24190,7 +24194,7 @@ class VirtualDomHorizontal extends Renderer{

var rowEl = row.getElement();
while(rowEl.firstChild) rowEl.removeChild(rowEl.firstChild);

this.initializeRow(row);
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.js.map

Large diffs are not rendered by default.

36 changes: 20 additions & 16 deletions dist/js/tabulator_esm.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Tabulator v6.3.0 (c) Oliver Folkerd 2024 */
/* Tabulator v6.3.0 (c) Oliver Folkerd 2025 */
class CoreFeature{

constructor(table){
Expand Down Expand Up @@ -23735,7 +23735,7 @@ class VirtualDomHorizontal extends Renderer{
if(column.visible){
if(!column.modules.frozen){
width = column.getWidth();

config.leftPos = colPos;
config.rightPos = colPos + width;

Expand Down Expand Up @@ -23793,7 +23793,7 @@ class VirtualDomHorizontal extends Renderer{
rowFrag.appendChild(cell.getElement());
});
row.element.appendChild(rowFrag);

row.cells.forEach((cell) => {
cell.cellRendered();
});
Expand All @@ -23806,7 +23806,11 @@ class VirtualDomHorizontal extends Renderer{

reinitializeColumnWidths(columns){
for(let i = this.leftCol; i <= this.rightCol; i++){
this.columns[i].reinitializeWidth();
let col = this.columns[i];

if(col){
col.reinitializeWidth();
}
}
}

Expand Down Expand Up @@ -23894,11 +23898,11 @@ class VirtualDomHorizontal extends Renderer{
reinitializeRows(){
var visibleRows = this.getVisibleRows(),
otherRows = this.table.rowManager.getRows().filter(row => !visibleRows.includes(row));

visibleRows.forEach((row) => {
this.reinitializeRow(row, true);
});

otherRows.forEach((row) =>{
row.deinitialize();
});
Expand Down Expand Up @@ -23945,7 +23949,7 @@ class VirtualDomHorizontal extends Renderer{
working = true;

while(working){

let column = this.columns[this.rightCol + 1];

if(column){
Expand All @@ -23963,7 +23967,7 @@ class VirtualDomHorizontal extends Renderer{
this.fitDataColActualWidthCheck(column);

this.rightCol++; // Don't move this below the >= check below

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.rightCol = this.rightCol;
Expand Down Expand Up @@ -24008,7 +24012,7 @@ class VirtualDomHorizontal extends Renderer{
});

this.leftCol--; // don't move this below the <= check below

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.leftCol = this.leftCol;
Expand Down Expand Up @@ -24066,7 +24070,7 @@ class VirtualDomHorizontal extends Renderer{

this.vDomPadRight += column.getWidth();
this.rightCol --;

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.rightCol = this.rightCol;
Expand All @@ -24088,7 +24092,7 @@ class VirtualDomHorizontal extends Renderer{
removeColLeft(){
var changes = false,
working = true;

while(working){
let column = this.columns[this.leftCol];

Expand All @@ -24110,7 +24114,7 @@ class VirtualDomHorizontal extends Renderer{

this.vDomPadLeft += column.getWidth();
this.leftCol ++;

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.leftCol = this.leftCol;
Expand Down Expand Up @@ -24156,17 +24160,17 @@ class VirtualDomHorizontal extends Renderer{
leftCol:this.leftCol,
rightCol:this.rightCol,
};

if(this.table.modules.frozenColumns){
this.table.modules.frozenColumns.leftColumns.forEach((column) => {
this.appendCell(row, column);
});
}

for(let i = this.leftCol; i <= this.rightCol; i++){
this.appendCell(row, this.columns[i]);
}

if(this.table.modules.frozenColumns){
this.table.modules.frozenColumns.rightColumns.forEach((column) => {
this.appendCell(row, column);
Expand All @@ -24190,7 +24194,7 @@ class VirtualDomHorizontal extends Renderer{

var rowEl = row.getElement();
while(rowEl.firstChild) rowEl.removeChild(rowEl.firstChild);

this.initializeRow(row);
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.mjs.map

Large diffs are not rendered by default.

34 changes: 19 additions & 15 deletions src/js/core/rendering/renderers/VirtualDomHorizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class VirtualDomHorizontal extends Renderer{
if(column.visible){
if(!column.modules.frozen){
width = column.getWidth();

config.leftPos = colPos;
config.rightPos = colPos + width;

Expand Down Expand Up @@ -178,7 +178,7 @@ export default class VirtualDomHorizontal extends Renderer{
rowFrag.appendChild(cell.getElement());
});
row.element.appendChild(rowFrag);

row.cells.forEach((cell) => {
cell.cellRendered();
});
Expand All @@ -191,7 +191,11 @@ export default class VirtualDomHorizontal extends Renderer{

reinitializeColumnWidths(columns){
for(let i = this.leftCol; i <= this.rightCol; i++){
this.columns[i].reinitializeWidth();
let col = this.columns[i];

if(col){
col.reinitializeWidth();
}
}
}

Expand Down Expand Up @@ -279,11 +283,11 @@ export default class VirtualDomHorizontal extends Renderer{
reinitializeRows(){
var visibleRows = this.getVisibleRows(),
otherRows = this.table.rowManager.getRows().filter(row => !visibleRows.includes(row));

visibleRows.forEach((row) => {
this.reinitializeRow(row, true);
});

otherRows.forEach((row) =>{
row.deinitialize();
});
Expand Down Expand Up @@ -330,7 +334,7 @@ export default class VirtualDomHorizontal extends Renderer{
working = true;

while(working){

let column = this.columns[this.rightCol + 1];

if(column){
Expand All @@ -348,7 +352,7 @@ export default class VirtualDomHorizontal extends Renderer{
this.fitDataColActualWidthCheck(column);

this.rightCol++; // Don't move this below the >= check below

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.rightCol = this.rightCol;
Expand Down Expand Up @@ -393,7 +397,7 @@ export default class VirtualDomHorizontal extends Renderer{
});

this.leftCol--; // don't move this below the <= check below

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.leftCol = this.leftCol;
Expand Down Expand Up @@ -451,7 +455,7 @@ export default class VirtualDomHorizontal extends Renderer{

this.vDomPadRight += column.getWidth();
this.rightCol --;

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.rightCol = this.rightCol;
Expand All @@ -473,7 +477,7 @@ export default class VirtualDomHorizontal extends Renderer{
removeColLeft(){
var changes = false,
working = true;

while(working){
let column = this.columns[this.leftCol];

Expand All @@ -495,7 +499,7 @@ export default class VirtualDomHorizontal extends Renderer{

this.vDomPadLeft += column.getWidth();
this.leftCol ++;

this.getVisibleRows().forEach((row) => {
if(row.type !== "group"){
row.modules.vdomHoz.leftCol = this.leftCol;
Expand Down Expand Up @@ -541,17 +545,17 @@ export default class VirtualDomHorizontal extends Renderer{
leftCol:this.leftCol,
rightCol:this.rightCol,
};

if(this.table.modules.frozenColumns){
this.table.modules.frozenColumns.leftColumns.forEach((column) => {
this.appendCell(row, column);
});
}

for(let i = this.leftCol; i <= this.rightCol; i++){
this.appendCell(row, this.columns[i]);
}

if(this.table.modules.frozenColumns){
this.table.modules.frozenColumns.rightColumns.forEach((column) => {
this.appendCell(row, column);
Expand All @@ -575,7 +579,7 @@ export default class VirtualDomHorizontal extends Renderer{

var rowEl = row.getElement();
while(rowEl.firstChild) rowEl.removeChild(rowEl.firstChild);

this.initializeRow(row);
}
}
Expand Down

0 comments on commit 000373b

Please sign in to comment.