材质UI-表分页是从零开始的索引,如何使其不为零

Material UI Table pagination is zero-indexed, which means if I am on page 1, it will go back to page 0. How can I enforce to stop at page 1?

enter image description here

I try passing something like this, page={pageNumber || 1}, but it still calls onChangePage. Even though it does not try to load Page 0, but still its bad User Experience. You expect the previous button to be disabled in the below screenshot,

enter image description here

https://material-ui.com/api/table-pagination/#tablepagination-api

评论
一起疯了
一起疯了

I don't know if I have the best solution, but I make it work, by subtracting -1 when feeding to page={pageNumber - 1}, and add +1 when onChangePage = (e, pageNumber) => {..pageNumber + 1} is called.

点赞
评论