fix: Change the value of pageOffset when enabling server side pagination (#36056)

## Description
Fixed issue #36022 where incorrect data is displayed when navigating to
the previous page after reaching the last page with fewer items in the
table during server-side pagination enabled by using `props.pageSize`
instead of `props.tableData?.length`.


Fix:

Replaced `props.tableData?.length` with `props.pageSize` to ensure
consistent data display when navigating between pages, especially when
dealing with the last page that has fewer items than the pageSize.


Fixes #36022

## Automation

/ok-to-test tags="@tag.Table"




## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Improved pagination logic for the table widget, simplifying the
handling of page size.

- **Bug Fixes**
- Resolved potential inconsistencies in pagination when server-side data
is utilized.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Phennapa Saeliw <psaeliw@gmail.com>
This commit is contained in:
phennapa-saeliw 2024-10-25 17:47:54 +07:00 committed by GitHub
parent cd26aedb97
commit 2ad374aa52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -978,10 +978,7 @@ export default {
},
//
getPageOffset: (props, moment, _) => {
const pageSize =
props.serverSidePaginationEnabled && props.tableData
? props.tableData?.length
: props.pageSize;
const pageSize = props.pageSize;
if (
Number.isFinite(props.pageNo) &&