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

How to have last and first page navigation in pagination ?

Open krsandesh opened this issue 6 years ago • 4 comments
trafficstars

In pagination we can just navigate to next and previous.

How to navigate directly to first page or last page ? Something as shown below

image

krsandesh avatar Sep 19 '19 07:09 krsandesh

In order to create your own custom pagination, you will need to use the customFooter option:

image

You can look at the customize-footer example for more information.

gabrielliwerant avatar Sep 19 '19 18:09 gabrielliwerant

On your customFooter , provide a custom component that has a TablePagination component and supply its ActionsComponent prop

CodeSandbox example: https://codesandbox.io/s/dztrr

You can copy the TableFooter component and its children as your base example.

rhaicode avatar Sep 20 '19 13:09 rhaicode

That CodeSandbox example throws an error on startup...

nickraphael avatar Aug 19 '20 00:08 nickraphael

 const { items } = usePagination({
    count: total,
    showLastButton: true, // add this for show go last button
    showFirstButton: true, // add this for show go first button
  });

when you are mapping items like

items.map((type) =>{
// you gonna access here type == 'first' and 'last' 
})

MenooaEskandarian avatar Oct 29 '24 11:10 MenooaEskandarian