primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.86k stars 1.04k forks source link

DataTable: Column width changes while scrolling if the content width is varied #6808

Open gabrielhpugliese opened 4 months ago

gabrielhpugliese commented 4 months ago

Describe the bug

As discussed previously here, there's no obvious/immediate way to make the column width to have fixed width (but still adjustable on drag and drop) if the content of the cells have different widths. It's very easy to reproduce on an infinite scroll DataTable while scrolling down.

Reproducer

https://stackblitz.com/edit/mhjis6?file=src%2Fservice%2FCarService.jsx

PrimeReact version

10.6.6

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to the stackblitz project or clone the project with infinite scroll and make a column content with longer width
  2. Scroll down and see the column width change/jump

Expected behavior

I understand that this behaviour can be beneficial for some but it would be useful to have a way to make the column width fixed regardless its content

melloware commented 4 months ago

Yep not all datatable features are compatible with other features so this may be a difficult one to make everyone happy but still work properly.

sja-cslab commented 2 months ago

@gabrielhpugliese in case that could help you in any way:

How I'm doing it ```js {visibleColumns.map((col, index) => ( ))} ```