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

Incorrent props type for GridPagination

Open scott-avery opened this issue 3 years ago • 1 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Current behavior 😯

Wrong definition for GridPagination props, see https://github.com/mui/mui-x/blob/d94c20e7471ca9b3bb4e889cd2e907868b942434/packages/grid/x-data-grid/src/components/GridPagination.tsx#L27-L29

now it's React.HTMLAttributes<HTMLDivElement>, wrong generic type for forwardRef

Expected behavior 🤔

it should be subtype of props type of TablePagination

Steps to reproduce 🕹

not needed

Context 🔦

No response

Your environment 🌎

not needed

Order ID 💳 (optional)

No response

scott-avery avatar Sep 21 '22 07:09 scott-avery

Hey @scott-avery Indeed, it should use TablePaginationProps instead:

- React.HTMLAttributes<HTMLDivElement>
+ Partial<TablePaginationProps>

Are you using GridPagination directly for some kind of customization? Can you share more details about your use case?

cherniavskii avatar Sep 21 '22 15:09 cherniavskii

@cherniavskii yes, I have to wrap the GridPagination to add a page select, allowing user to go to specific page quickly. Currently that function is not available in official library.

scott-avery avatar Sep 22 '22 01:09 scott-avery

@scott-avery Thanks for the details! By the way, there's a demo using Material UI Pagination component instead of default TablePagination: https://mui.com/x/react-data-grid/components/#pagination Maybe you'll find it useful as well

cherniavskii avatar Sep 22 '22 14:09 cherniavskii