mui-datatables icon indicating copy to clipboard operation
mui-datatables copied to clipboard

Uncaught TypeError: onPageChange is not a function

Open danielsann99 opened this issue 4 years ago • 23 comments

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 avatar Jun 04 '21 15:06 danielsann99

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

danielsann99 avatar Jun 07 '21 08:06 danielsann99

I have had the same issue

davlasry avatar Jul 13 '21 19:07 davlasry

Same issue here

shubhankar30 avatar Jul 14 '21 09:07 shubhankar30

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

igor-pavlichenko avatar Jul 19 '21 12:07 igor-pavlichenko

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

emekaokoli avatar Aug 31 '21 10:08 emekaokoli

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

IBonkI avatar Sep 02 '21 12:09 IBonkI

+1

crgaurav avatar Sep 14 '21 12:09 crgaurav

+1

BiancaArtola avatar Sep 28 '21 13:09 BiancaArtola

+1

aliammaar avatar Oct 28 '21 08:10 aliammaar

+1

harikautilya avatar Oct 28 '21 23:10 harikautilya

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

Castalia-cong avatar Nov 29 '21 23:11 Castalia-cong

I expect the solution of this error

Castalia-cong avatar Nov 29 '21 23:11 Castalia-cong

+1

romaincoeur avatar Dec 04 '21 15:12 romaincoeur

+3

emanuel-maker avatar Dec 11 '21 21:12 emanuel-maker

+1

epotvin avatar Dec 15 '21 18:12 epotvin

+1

MichaelBalla avatar Jan 13 '22 23:01 MichaelBalla

+1

ranfysvalle02 avatar Jan 15 '22 18:01 ranfysvalle02

+1

SuryaTeja-koka avatar Jan 30 '22 15:01 SuryaTeja-koka

+1

kamauge avatar Mar 23 '22 12:03 kamauge

+1

BibhushanKarki avatar May 03 '22 05:05 BibhushanKarki

+1

ileonardt avatar May 25 '22 05:05 ileonardt

Any solution on this one yet?

fahimul-zilani avatar Jul 27 '22 09:07 fahimul-zilani

My workaround was to provide my own pagination component

igor-pavlichenko avatar Jul 27 '22 21:07 igor-pavlichenko