Search code examples
reactjsmaterial-table

Trigger event on page change


With material-table component, how can I trigger an event when the page changes? I want to do this, because I want to keep the page number to restore the state.

import MaterialTable from 'material-table';

...

render() {
    return (
        <div style={{ maxWidth: "100%" }}>
        <MaterialTable
            icons={tableIcons}
            options={
            {
                exportButton: true,
                exportAllData: true,
                selection: false,
                filtering: true,
                pageSize: 10,
                pageSizeOptions: [5, 10, 25]
            }
            }
            columns={columns}
            data={tableData}
            title={title}
        />
        </div>
    );
    }

Solution

  • Use onChangePage. It's a props of MaterialTable.

    Material Table All Props