Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The table displays incorrect data when server-side pagination is enabled, and the length of the last page is less than the pageSize value. #36022

Closed
1 task done
phennapa-saeliw opened this issue Aug 30, 2024 · 1 comment · Fixed by #36056
Assignees
Labels
Bug Something isn't working Community Reported issues reported by community members High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Production Table Widget Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets

Comments

@phennapa-saeliw
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Description

The pageOffset value is working incorrectly if the last page of the table widget has a length less than the pageSize value.

Steps To Reproduce

  1. Drag and drop a table widget
  2. Using PostgreSQL as the datasource.
  3. Click the 'Connect Data' button to select table, and Appsmith will automatically generate the query.
    2567-08-30 at 22 38
  4. Appsmith use the pageOffset prop for query offset
    2567-08-30 at 22 39
  5. Press the 'Next Page' button until reaching the last page, then press the 'Previous Page' button, the data displayed in the table will be incorrect, according to the example in the video.
  6. The pageOffset value was 64 before changing to 80 on the pageNo = 9.

Public Sample App

https://app.appsmith.com/app/server-side-pagination/page1-66d1dde63ec3612915d62a75

Environment

Production

Severity

Medium (Frustrating UX)

Issue video log

https://www.loom.com/share/2036895ffb8941b1954183f982261f0e?sid=121fc0ef-e4f7-456c-9478-65173d7a534b

Version

Cloud - 1.38.0

@phennapa-saeliw phennapa-saeliw added Bug Something isn't working Needs Triaging Needs attention from maintainers to triage labels Aug 30, 2024
@Nikhil-Nandagopal Nikhil-Nandagopal added Community Reported issues reported by community members Medium Issues that frustrate users due to poor UX Production labels Aug 30, 2024
@phennapa-saeliw
Copy link
Contributor Author

I tried changing the query from using {{Table1.pageOffset}} to {{(Table1.pageNo - 1) * Table1.pageSize}} and found that when I clicked the next page until the last page (the last page must have fewer data items in the table than the pageSize value), and then clicked the prev page, the data displayed correctly.

2567-08-30 at 23 41

@Nikhil-Nandagopal Nikhil-Nandagopal added Table Widget High This issue blocks a user from building or impacts a lot of users and removed Medium Issues that frustrate users due to poor UX labels Sep 2, 2024
@github-actions github-actions bot added Widgets Product This label groups issues related to widgets Widgets & Accelerators Pod Issues related to widgets & Accelerators labels Sep 2, 2024
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this issue Nov 20, 2024
…ion (appsmithorg#36056)

## Description
Fixed issue appsmithorg#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 appsmithorg#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Community Reported issues reported by community members High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage Production Table Widget Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants