1

Instead of having the whole window that scrolled (found on the web):

function pageScroll() {
    window.scrollBy(0,50); // horizontal and vertical scroll increments
    scrolldelay = setTimeout('pageScroll()',100); // scrolls every 100 milliseconds
}

than in the HTML code

<body onLoad="pageScroll()">

,

I would rather want only my table to jump/scroll down until the last row.

Do I need to create a new method for the google table?

Thx

1 Answers1

3

If your table has a fixed height set in options and is large enough to enable scrolling, then you need to do something similar to scroll the scrollable portion of the table:

var myTable = new google.visualization.Table(document.querySelector('#table_div'));

function scrollTable () {
    var el = document.querySelector('#table_div > div > div:first-child');
    if (el) {
        el.scrollTop = el.scrollTop + 50;
        if (el.scrollTop + el.offsetHeight < el.scrollHeight) {
            setTimeout(scrollTable, 100);
        }
    }
}

google.visualization.events.addListener(myTable, 'ready', scrollTable);

myTable.draw(data, options);
asgallant
  • 26,060
  • 6
  • 72
  • 87