primefaces / primefaces/primereact

DataTable: issue with virtualScroll when initialized in non visible panel

Open
#8,208 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I'm using a DataTable with a VirtualScroller inside a div with display: "none", and the DataTable does not appear when I remove the display: "none" style.

It looks a bit similar to https://github.com/primefaces/primereact/issues/7516.

Reproducer

https://stackblitz.com/edit/znxq12ml?file=src%2FApp.jsx

System Information
System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    primereact: latest => 9.6.3 
    react: 18.3.1 => 18.3.1
Steps to reproduce the behavior
  1. Go to https://stackblitz.com/edit/znxq12ml?file=src%2FApp.jsx
  2. Click on the button "2"
  3. The table dos not appear

Notes:

  • If I change to useState(1); to first show the table "tab", it does appear, but if I click the "1" button and then the "2" button is disappears once again.
  • If I remove the VirtualScroller option everything works fine.
Expected behavior

The DataTable should be visible.

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 with the linked StackBlitz reproducer and its src/App.jsx, then inspect the DataTable and VirtualScroller behavior when the component begins inside a display:none panel. Verify the case by switching between buttons 1 and 2, and consider the issue done when the table becomes visible after panel changes while VirtualScroller remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.