Skip to content

[grid] Grid with DataProvider shows blank lines after toggling visibility #2164

@DiegoCardoso

Description

@DiegoCardoso

Description

If you have a vaadin-grid with data provider and toggle the hidden attribute, the grid shows empty rows when its visibility is restored. It doesn't happen when the grid is not scrolled, but after you pass the first page (or at least after the second page is resquested).

Expected outcome

Rows are visible after grid hidden attribute is removed.

Actual outcome

Grid shows empty rows after hidden attribute is removed.

Live Demo (optional)

Edge / Chrome / Safari

grid-issue.mp4

Firefox

On Firefox, on top of the issue described, I can see the same issue reported on #2127 (see the scroller when the grid is stuck on "Item #23")

grid-issue-firefox.mp4

Minimal reproducible example

private items = Array.from({ length: 500 }).map((_, index) => ({ name: `Item #${index + 1}` }));

@state()
private gridHidden = false;

render() {
  return html`
    <button @click="${() => (this.gridHidden = !this.gridHidden)}">toggle grid visibility</button>
    <vaadin-grid
      .dataProvider="${(params: GridDataProviderParams<any>, callback: GridDataProviderCallback<any>) => {
        const {page, pageSize} = params;

        const items = this.items.slice(page * pageSize, (page + 1) * pageSize)
        callback(items, this.items.length)
      }}"
      ?hidden="${this.gridHidden}"
    >
      <vaadin-grid-column path="name"></vaadin-grid-column>
    </vaadin-grid>`
}

Steps to reproduce

Clear steps describing how to reproduce the issue.

  1. Put a vaadin-grid with data provider on the page
  2. Scroll down until the second page is fetched
  3. Toggle visibility

Environment

  • v21.0.0-alpha11.
  • mac OS.

Browsers Affected

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE 11
  • iOS Safari
  • Android Chrome

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions