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] Dragging with scrollbar shifts table body downwards #1691

Closed
2 tasks done
Peppe opened this issue Sep 25, 2019 · 2 comments · Fixed by vaadin/vaadin-grid#2217
Closed
2 tasks done

[grid] Dragging with scrollbar shifts table body downwards #1691

Peppe opened this issue Sep 25, 2019 · 2 comments · Fixed by vaadin/vaadin-grid#2217
Assignees

Comments

@Peppe
Copy link
Contributor

Peppe commented Sep 25, 2019

Description

When scrolling by dragging the scrollbar on a long grid, the grid becomes more and more empty as the area where the rows are rendered is moved downwards at all time. The rows are exactly where they need to be but the rows that should be rendered is wrong. The visual bug is fixed instantly by using wheel scroll on the grid.

Screenshot of the problem
Screenshot 2019-09-25 at 12 51 34

Gif for producing the issue
fast-scroll-bug

It works differently in different browsers. In Chrome it is easiest to see it to slowly drag the scrollbar from top to bottom, and the top of the body wont be rendererd. In Firefox, you get it visible by first going to the bottom and from the slowly scrolling upwards. Also then the top of the grid is not rendered, so it is inverted between the browsers.

Expected outcome

All the rows in the body area would be rendered.

Steps to reproduce

Lit element

import { LitElement, html } from 'lit-element'; 
import "@vaadin/vaadin-grid"

class GridView extends LitElement { 

  constructor() {
    super();
    var element = this;
    customElements.whenDefined('vaadin-grid').then(function() {
      const grid = element.shadowRoot.getElementById('mygrid');
      grid.size = 120000;
      grid.dataProvider = function(params, callback) {
        console.log(`Fetch: ${params.page * params.pageSize}, Limit: ${params.pageSize}`);
        const response = Array.from({length: params.pageSize}, (v, k) => {return {value: params.page * params.pageSize + k}}); 
        setTimeout(() => callback(response), 500);
      };
    });
  }
  render() {
    return html` 
      <vaadin-grid id="mygrid">
        <vaadin-grid-column path="value"></vaadin-grid-column>
      </vaadin-grid>
    `;
  }
}

customElements.define('grid-view', GridView);

Browsers Affected

  • Chrome
  • Firefox
  • ? Safari
  • ? Edge
  • ? IE 11
  • ? iOS Safari
  • ? Android Chrome
@jcgueriaud1
Copy link
Contributor

The problem is related to the virtual items set to 100.000 in vaadin-grid-scroller
const maxVirtualItems = this._edge || this._ie ? 30000 : 100000;

If you changed the default value to 130000 then it's working.

@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-grid May 19, 2021
@web-padawan web-padawan changed the title Dragging with scrollbar shifts table body downwards [grid] Dragging with scrollbar shifts table body downwards May 28, 2021
@tomivirkki
Copy link
Member

This is a bug in <iron-list> which is used as the virtual scrolling engine in Grid. The bug is reproducible with:

<iron-list style="height: 300px">
  <template>
    <div>[[item.name]]</div>
  </template>
</iron-list>

<script>
  const list = document.querySelector("iron-list");

  list.items = Array.from({ length: 100000 }, (_, i) => {
    return { name: "Item " + i };
  });
</script>
iron-list-scroll-bug.mp4

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

Successfully merging a pull request may close this issue.

4 participants