6pac / 6pac/SlickGrid

Fix for CSS Rendering Issue at large row counts

Open
#1,044 37 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

under discussion
Dominant language
TypeScript
Stars
2.1k
Forks
429
Avg merge
1d 8h
Merged PRs (30d)
18

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in slick.grid.ts at appendRowHTML and reproduce the rendering problem with a grid of approximately 10 million rows and grid line styles. Compare the existing row positioning with the suggested transform-based positioning, then run the repository tests and verify that row rendering remains correct at large counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.