mui-datatables: Uncaught TypeError: onPageChange is not a function
Hi,
In my table when I switch pages and rows it doesn’t work
At the moment of rendering the content of the table is present, even the functions are all functional, outside the page switch and the selection of the rows to be displayed.
console error{
Warning: Failed prop type: The prop onPageChange is marked as required in ForwardRef(TablePagination), but its value is undefined
}
console error{
Warning: Unknown event handler property onChangePage. It will be ignored.
}
console error{
index.js:1 Warning: Unknown event handler property onChangeRowsPerPage. It will be ignored.
}
at each click of the icon to change the page or select the lines to be displayed, the following error is printed in the console
Uncaught TypeError: onPageChange is not a function.
here is my code…
const columns = [
{
name: "id",
label: "ID",
},
{
name: "createdAt",
label: "Data",
options: {
filter: true,
sort: true,
}
},
{
name: "dest_nominativo",
label: "Destinatario",
options: {
filter: true,
sort: true,
}
},
];
const options = {
filter: true,
filterType: "dropdown",
customToolbarSelect: (data, item) => {
return (
<div style={{paddingRight:10}}>
<Button type="submit" variant='outlined' color='primary'
onClick={() => {
calcoloArrayID(data)
}}>
Convalida
</Button>
</div>
)
},
onChangeRowsPerPage: (data) => {
},
onRowSelectionChange: (data) => {
},
onRowClick: (data) => {
history.push({ pathname: '/customer/dashboard/spedizione', state: { code: 1, id: data[0] } });
}
};
<MUIDataTable
title={"title"}
data={data}
columns={columns}
options={options}
/>
–>
|--------------|---------| | Material-UI | | MUI-datatables | 3.7.7 | | React | js | | browser | chrome/safari | | etc | |
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 4
- Comments: 23
It has to do with @material-ui v5, they changed the names of those props and in latest versions completely deprecated them.
Relates to https://github.com/gregnb/mui-datatables/issues/1747