appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.42k stars 3.72k forks source link

[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 phennapa-saeliw closed 1 week ago

phennapa-saeliw commented 2 months ago

Is there an existing issue for this?

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 commented 2 months ago

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