vaadin-grid Scrolling

Scrolling vaadin-grid

JS API provides functions for scrolling vaadin-grid programmatically.

var grid = grid || document.querySelector("vaadin-grid"); HTMLImports.whenReady(function() { grid.items = employees; // code // Some functionality requires all the previous processes // to be finished before executing. Scrolling to a row // naturally needs rows to exist so we'll wrap the // actual call inside a function and pass it to vaadin-grid as a "then" // callback so it's executed only after everything // else is finished. grid.then(function() { // Scroll to a specific row. grid.scrollToRow(70); }); // end-code grid.columns[0].renderer = function(cell) { cell.element.innerHTML = cell.row.index; } document.getElementById("scrollToStart").addEventListener("click", function() { grid.scrollToStart(); }); document.getElementById("scrollToEnd").addEventListener("click", function() { grid.scrollToEnd(); }); document.getElementById("scrollToRow").addEventListener("click", function() { grid.scrollToRow(100); }); });