Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid not refreshing correctly when placed into a dialog which is resized #6431

Open
Levaimate opened this issue Aug 30, 2023 · 3 comments
Open

Comments

@Levaimate
Copy link

Description

I added a grid with a large amount of rows into a resizable dialog. When the grid is scrolled to the bottom and the dialog is resized (made taller) the grid can get stuck, most of it can be empty. This is only fixed when scrolling into the grid or resizing the dialog back and forth.
image

Expected outcome

The grid should always be filled with data upon resizing the container dialog.

Minimal reproducible example

Button theButton = new Button("open dialog");
        Dialog dialog = new Dialog();
        Grid<String> grid = new Grid<>();
        grid.setSizeFull();
        grid.addColumn(String::toString).setHeader("name");
        grid.setItems(generateItems(10000));
        HorizontalLayout layout = new HorizontalLayout(grid);
        layout.setSizeFull();
        dialog.add(layout);
        dialog.setResizable(true);
        dialog.setDraggable(true);


        theButton.addClickListener(event -> {
            dialog.open();
        });

        add(theButton);
 

    private List<String> generateItems(int num) {
        List<String> list = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < num; i++) {
            list.add(String.valueOf(random.nextInt(1000)));
        }
        return list;
    }

Steps to reproduce

  1. Open the dialog (ideally at a small size so it can be made bigger)
  2. Scroll the grid to the bottom (not fully necessary but it makes it easier to reproduce)
  3. Resize the dialog so the grid inside can fit more items
  4. Sometimes after resizing the top of the grid stays empty, with only a few items listed at the bottom

Environment

Vaadin version(s): 24.1.4
OS: Windows 10

Browsers

Chrome

@tomivirkki
Copy link
Member

tomivirkki commented Aug 30, 2023

The issue also produces in https://vaadin.com/docs/latest/components/dialog#resizable

Even the V14 example has the issue (you have to expand the dialog higher though to see it because V14 grid had more rows by default): https://vaadin.com/docs/v14/ds/components/dialog#resizable

@tomivirkki tomivirkki transferred this issue from vaadin/flow-components Aug 31, 2023
@tomivirkki
Copy link
Member

This is a bug in the iron-list virtual scrolling engine. Needs another workaround to the adapter.

@yuriy-fix yuriy-fix added bug Something isn't working Impact: Low Severity: Major labels Sep 6, 2023
@AndreasSamjeske
Copy link

The issue also produces in https://vaadin.com/docs/latest/components/dialog#resizable

You don't even need to resize the dialog. Closing an reopening seems to trigger the same or a similar bug:

  1. Click "Show dialog".
  2. Scroll down to about the middle.
  3. Click outside the dialog to close it.
  4. Click "Show dialog".
    Result: No data in grid shown. Scrolling, even horizontally, triggers data to be shown again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants