splatter0 opened a new issue, #42243:
URL: https://github.com/apache/superset/issues/42243

   ### Bug description
   
   In the standard **Table** chart, the server-pagination page-size selector 
behaves incorrectly when the total row count is smaller than the configured 
**Server Page Length**.
   
   With 12 total rows and `Server Page Length = 20`, all 12 rows are correctly 
displayed on one page, but the **Show entries per page** selector displays `0` 
and `10` instead of the configured value `20`.
   
   After selecting `10`, the table correctly changes to two pages, but the `20` 
option disappears from the selector. It is then impossible to return to a 
one-page display without refreshing the page.
   
   ### How to reproduce the bug
   
   1. Create a standard **Table** chart whose query returns exactly 12 rows.
   2. Set **Row limit** to `10000`.
   3. Enable **Server pagination**.
   4. Set **Server Page Length** to `20`.
   5. Save or render the chart.
   6. Observe that all 12 rows are displayed on one page, while the page-size 
selector contains `0` and `10`.
   7. Select **Show 10 entries per page**.
   8. Observe that the table now has two pages.
   9. Open the page-size selector again.
   
   ### Expected results
   
   - The selector should display `20` as the current page size.
   - The configured page size should remain available even when it is greater 
than the total row count.
   - Users should be able to switch from `10` back to `20` without refreshing.
   - A page size of `0` should not appear unless it is a real supported option.
   
   ### Actual results
   
   - The selector displays `0` when the configured page size is `20` and the 
total row count is 12.
   - After selecting `10`, the `20` option disappears.
   - The only way to restore the configured one-page display is to refresh the 
page.
   
   ### Suspected cause
   
   In `TableChart.tsx`, server page-size options are filtered using `n <= 
rowCount`:
   
   
https://github.com/apache/superset/blob/6.1.0/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx#L388-L395
   
   When `rowCount = 12`, the configured page size `20` is removed from the 
available options.
   
   Then, in `DataTable.tsx`, when no available option is greater than or equal 
to the current server page size, `resultCurrentPageSize` is changed to `0`:
   
   
https://github.com/apache/superset/blob/6.1.0/superset-frontend/plugins/plugin-chart-table/src/DataTable/DataTable.tsx#L460-L473
   
   A possible fix would be to avoid filtering server-side page-size options by 
`rowCount`, or at least always preserve the configured/current page size. The 
component should also avoid converting a valid current page size to `0`.
   
   ### Environment
   
   - Apache Superset: 6.1.0
   - Installation: PyPI
   - Python: 3.11
   - Server OS: OpenCloudOS
   - Database: MySQL
   - Visualization: Standard Table
   - Server pagination: Enabled
   - Row limit: 10000
   - Server Page Length: 20
   - Total result rows: 12
   
   ### Additional context
   
   The issue is reproducible after saving the chart and also in the 
rendered/shared table. Refreshing the page temporarily restores the configured 
page size, but the incorrect selector state returns.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to