react-data-table-component icon indicating copy to clipboard operation
react-data-table-component copied to clipboard

Make paginationPage an optional, controllable property

Open bembleton opened this issue 3 years ago • 6 comments

  • add paginationPage property to DataTable
  • call handleChangePage when paginationPage changes
  • maintain existing pagination controls and actions

I was looking for a way to reset the table back to the first page, and I was not happy with the way that paginationResetDefaultPage works. I prefer using a value/onValueChanged pattern so I would like to add a paginationPage property to control which page is selected when using either client-side or server-side pagination. It's expected that paginationPage and onChangePage are used together and kept in sync so that the pagination controls and actions still work:

const [page, setPage] = useState(1);

<DataTable
	data={data}
	columns={columns}
	pagination
	paginationPage={page}
	onChangePage={setPage}
/>

bembleton avatar Apr 14 '22 20:04 bembleton

Deploy Preview for react-data-table-component ready!

Name Link
Latest commit caf564b43b41e5858c03a592bff5c42494c84771
Latest deploy log https://app.netlify.com/sites/react-data-table-component/deploys/625d845ece99ee0008c59aef
Deploy Preview https://deploy-preview-1037--react-data-table-component.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Apr 14 '22 20:04 netlify[bot]

Any release date?

GabrielLourenco avatar Aug 29 '22 12:08 GabrielLourenco

Looking great!

MarcoDeJong avatar Nov 25 '22 13:11 MarcoDeJong

ERA for merge?

garrylachman avatar Dec 07 '22 04:12 garrylachman