Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material-UI: How can I change TablePagination caption that tells how many rows shown?

I want to change the string of the word "of" to another word, I tried to do so through node_modules but it didn't work.

Here is my code:

<TableFooter>
  <TableRow>
    <TablePagination
      rowsPerPageOptions={[5, 10, 25, { label: "All", value: -1 }]}
      count={props.generalIndicatorDataItem.length}
      rowsPerPage={rowsPerPage}
      page={page}
      labelRowsPerPage="عدد السلع فى الصفحة"
      onChangePage={handleChangePage}
      onChangeRowsPerPage={handleChangeRowsPerPage}
      ActionsComponent={TablePaginationActions}
    />
  </TableRow>
</TableFooter>

And here is a screenshot of what I have:

enter image description here

like image 365
mostafa elbanna Avatar asked Sep 07 '25 01:09

mostafa elbanna


1 Answers

labelDisplayedRows props is a callback with the following signature:

({ from, to, count }) => string

This is how you use it correctly:

labelDisplayedRows={({ from, to, count }) =>
  `${from}-${to} OF ${count !== -1 ? count : `MORE THAN ${to}`}`}

Live Demo

Edit 67297785/material-ui-how-can-i-change-tablepagination-caption-that-tells-how-many-rows-s

like image 74
NearHuscarl Avatar answered Sep 11 '25 09:09

NearHuscarl