Mui-datatables: Reset scroll for client side transition apps

Created on 13 Feb 2019  路  1Comment  路  Source: gregnb/mui-datatables

Does anyone know how to manually scroll the table back to the top?

Because I use client-side transition, if I scroll down, go to a new page with the same table, the table is in the same scroll position as I left it in another page.

Most helpful comment

By using the onChangePage method, and then looking up the table, I was able to get it to scroll to the top like this:

onChangePage: () => {
          const table = document.querySelector("table");
          table.scrollIntoView(true);
        }

hope this helps!

>All comments

By using the onChangePage method, and then looking up the table, I was able to get it to scroll to the top like this:

onChangePage: () => {
          const table = document.querySelector("table");
          table.scrollIntoView(true);
        }

hope this helps!

Was this page helpful?
0 / 5 - 0 ratings