In my application I'm using a DataGrid component to show the results I get after querying a database. I was using the default pagination provided by the component and it worked perfectly. Nonetheless, now I would like to add a new field next to the pagination with extra information. The next figure show how the pagination is shown, remarking in red what I would like to add:

I tried to use a custom component as described here. First, I tried to include a custom footer component, but it replaced the entire default pagination component. Then, I've been trying to use a custom pagination component by including the new field I would like to add, together with the pagination. The problem is that I don't know how to connect the TablePagination component, which is supposed to be the pagination used by default according to the documentation, with the DataGrid component.
The documentation provides an example of how to use a Pagination component with the DataGrid:
function CustomPagination() {
const { state, apiRef } = useGridSlotComponentProps();
const classes = useStyles();
return (
<Pagination
className={classes.root}
color="primary"
count={state.pagination.pageCount}
page={state.pagination.page + 1}
onChange={(event, value) => apiRef.current.setPage(value - 1)}
/>
);
}
export default function CustomPaginationGrid() {
const { data } = useDemoData({
dataSet: 'Commodity',
rowLength: 100,
maxColumns: 6,
});
return (
<div style={{ height: 400, width: '100%' }}>
<DataGrid
pagination
pageSize={5}
components={{
Pagination: CustomPagination,
}}
{...data}
/>
</div>
);
}
However, the TablePagination has different props to fill:
<TablePagination
component="div"
count={100}
page={page}
onPageChange={handleChangePage}
rowsPerPage={rowsPerPage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
I was able to get the state, options and apiRef from the DataGrid by using useGridSlotComponentProps(). I would like to know how to fill the TablePagination props in order to make it work with the DataGrid. My best shot was the following one:
<TablePagination
component="div"
count={state.pagination.pageCount}
page={state.pagination.page + 1}
onPageChange={(event, value) => apiRef.current.setPage(value - 1)}
rowsPerPage={options.pageSize}
onRowsPerPageChange={null}
/>
On the one hand, I've no idea about what to write in the onRowsPerPageChange. On the other hand, this does not work very well.
I hope this question is clear enough. Thanks beforehand.