vaadin / vaadin/framework

Grid - recalculateColumnWidths on Scrolling Event OR based on the whole container

Open
#6,611 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement workaround
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Originally by quambel


I set the size of my Grid to setSizeFull and adds more data than could display at once. The grid adds a scrollbar by itself. When I scroll through the items the width of the column doesn't resize. If the line is wider than the previous one the content isn't completely displayed. When I scroll down and execute the recalculateColumnWidths() method the column width resize to the items but only to the items that are visible.

Can you please execute the recalculateColumnWidths method while scrolling?

Or can you please add a scrolling listener to the grid? Then I could integrate it by myself.

Or can you please calculate the coulmn with of each column on the biggest cell of the whole container, not only on the visible items?

My workaround:
recalculateColumnWidths every 2 seconds, works but this is the worst solution


Imported from https://dev.vaadin.com/ issue #17438

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 at the Grid.recalculateColumnWidths() entry point and trace how column widths are measured for visible items during scrolling. Reproduce the issue with a full-size Grid containing more rows than fit on screen, then determine the expected behavior for newly visible wider content or whole-container measurement. Done means column content remains fully visible without periodic polling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.