gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 932 forks source link

Uncaught TypeError: onPageChange is not a function #1735

Open danielsann99 opened 3 years ago

danielsann99 commented 3 years ago

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 | |

danielsann99 commented 3 years ago

Hello, I tried to reproduce the error with code sandbox, the error arises only when I install the dependencies: "@ emotion / react": "^ 11.4.0", "@ emotion / styled": "^ 11.3.0",

I leave you the sandbox link here, you can notice that the selection of the lines remains does not work.

---> https://codesandbox.io/s/sparkling-wind-dtji1?file=/src/App.js:0-1977

davlasry commented 3 years ago

I have had the same issue

shubhankar30 commented 3 years ago

Same issue here

igor-pavlichenko commented 3 years ago

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

emekaokoli commented 3 years ago

How do we solve this? I even downgrade @material-ui to v4 but the error persisted.

IBonkI commented 3 years ago

How do we solve this? I even downgrade @material-ui to v4 but the error persisted.

Wait for this to get into new Version https://github.com/gregnb/mui-datatables/pull/1748#issuecomment-897861778

crgaurav commented 3 years ago

+1

BiancaArtola commented 3 years ago

+1

aliammaar commented 2 years ago

+1

harikautilya commented 2 years ago

+1

Castalia-cong commented 2 years ago

I got the error in fuse react mui-data table. Uncaught TypeError: onChangePage is not a function

Castalia-cong commented 2 years ago

I expect the solution of this error

romaincoeur commented 2 years ago

+1

emanuel-maker commented 2 years ago

+3

epotvin commented 2 years ago

+1

MichaelBalla commented 2 years ago

+1

ranfysvalle02 commented 2 years ago

+1

SuryaTeja-koka commented 2 years ago

+1

kamauge commented 2 years ago

+1

BibhushanKarki commented 2 years ago

+1

ileonardt commented 2 years ago

+1

fahimul-zilani commented 2 years ago

Any solution on this one yet?

igor-pavlichenko commented 2 years ago

My workaround was to provide my own pagination component