Skip to content

Fix for CSS Rendering Issue at large row counts #1044

@pbower

Description

@pbower

Describe the bug

Hi @ghiscoding ,

Hope you're doing well.

Wondering if you have a moment to take a quick look at a bug / suggested fix?

Problem:
I recently encountered a CSS rendering issue at large counts:

image

See correct styles here for comparison:

image

Solution:
I found that it relates to this line of code in appendRowHTML for slick.grid.ts:

   const frozenRowOffset = this.getFrozenRowOffset(row);
    const rowDiv = Utils.createDomElement('div', { className: `ui-widget-content ${rowCss}`, role: 'row', style: { top: `${this.getRowTop(row) - frozenRowOffset}px` } });
    let rowDivR: HTMLElement | undefined;
    divArrayL.push(rowDiv);
    if (this.hasFrozenColumns()) {
      // it has to be a deep copy otherwise we will have issues with pass by reference in js since
      // attempting to add the same element to 2 different arrays will just move 1 item to the other array
      rowDivR = rowDiv.cloneNode(true) as HTMLElement;
      divArrayR.push(rowDivR);
    }

The following fix resolves the issue, and the repo tests still seem ok:

      const frozenRowOffset = this.getFrozenRowOffset(row);
      const topValue = this.getRowTop(row) - frozenRowOffset; // Calculated top value
      const rowDiv = Utils.createDomElement('div', {
        className: `ui-widget-content ${rowCss}`,
        role: 'row',
        style: { transform: `translateY(${topValue}px)` } // Using transform instead of top
      });
      

image

If this all looks ok to you, wondering if a special access is required to push a branch with the fix ? As I tried to but it said access denied.

Thanks,
Pete

Reproduction

Grid with approx 10m rows with grid line styles . - > close to 10m it will encounter rendering issues.

Which Framework are you using?

React

Environment Info

System:
    OS: Linux 6.8 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900KF
    Memory: 51.57 GB / 62.58 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.15.1/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.15.1/bin/npm
  Browsers:
    Chrome: 126.0.6478.182

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions