Skip to content

How can I mimic the pageSize from v6 in v7? #2172

Discussion options

You must be logged in to vote

I came up with a solution. Maybe there is a better way to do this but I wasn't able to find any. I'd love to know it if someone has one.

Anyway, I created a function that finds out how many pages short of the pageSize the current page is and creates that number of rows full of empty (   ) cells. I base the cells on page[ 0 ] so that I am able to pass in the proper row and cell props via ...page[ 0 ].getRowProps and { ...cell.getCellProps() }. This way all of the cells are properly sized.

const renderEmptyRows =  = useCallback( () => {
	let emptyRows = [];

	if ( page.length < pageSize ) {
		const emptyRowsToRender = pageSize - page.length;

		for ( let i = 0; i < emptyRowsToRender; i++ ) …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jonathansgardner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant