Confusing sort interface
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 20/100
研究方向
Start with the table component’s sorting behavior and discussion #778, which is cited as related context. The issue gives a SQL example with pagination but names no source files or tests; trace how sort column and direction are handled and how they could reach the backend query. Done means sorting applies to the full result set across pages; an open pull request (#1445) already exists.
由索引模型根據 Issue 內容生成。
描述
Introduction
Any table which has more rows than the page size can deliver wrong results if sorted by the column headers in the table component. This is significant if you have a table lots of rows that is paginated by the pagination component.
To Reproduce
The issue is very simple, just select a table with more tuples then your pagination (say a pagination of 100 for a total records of 500), sort it by the table header and then advance to the following page.
SELECT 'table' AS component, true AS sort,
'/atti/edit.sql?id_soc={id}' AS edit_url,
'/atti/delete.sql?id_soc={id}' AS delete_url;
SELECT
t.id_atto::text AS _sqlpage_id,
COALESCE(t.notaio::text, '—') AS "Notaio",
COALESCE(t.filza::text, '—') AS "Filza",
COALESCE(t.documento_n::text, '—') AS "Documento n.",
to_char(t.data_stipula, 'DD/MM/YYYY') AS "Data Stipula",
COALESCE(t.tipo_atto::text, '—') AS "Tipo Atto",
COALESCE(t.regesto::text, '—') AS "Regesto"
FROM atti AS t
ORDER BY t.id_atto
LIMIT 100 OFFSET COALESCE(CAST(NULLIF($offset, '') AS INTEGER), 0);
SELECT 'pagination' AS component;
SELECT
(g.i / 100 + 1) AS contents,
sqlpage.link(sqlpage.path(), jsonb_strip_nulls(jsonb_build_object('offset', g.i, 'notaio', NULLIF($notaio, ''), 'filza', NULLIF($filza, ''), 'documento_n', NULLIF($documento_n, ''), 'sort', COALESCE(NULLIF($sort, ''), 'id_atto'), 'dir', NULLIF($dir, '')))) AS link,
(g.i = COALESCE(CAST(NULLIF($offset, '') AS INTEGER), 0)) AS active
FROM generate_series(0, GREATEST((SELECT count(*) FROM atti AS t WHERE (NULLIF($notaio, '') IS NULL OR t.notaio::text ILIKE '%' || $notaio || '%') AND (NULLIF($filza, '') IS NULL OR t.filza::text ILIKE '%' || $filza || '%') AND (NULLIF($documento_n, '') IS NULL OR t.documento_n::text ILIKE '%' || $documento_n || '%')) - 1, 0), 100) AS g(i);
Actual behavior
The order is valid only for the current page (and selection!). If I understand well, there is no way to forward it towards the database.
There is an open discussion "Table filtering, sorting, pagination." by jeneizs-74 here:
https://github.com/sqlpage/SQLPage/discussions/778
It has no answer since Jan 15, 2025.
This may lead to errors and Is anyway confusing for the user who may think sorting shows the proper records, while he will get only the result of sorting the page records.
Expected behavior
I think sorting should happen on the entire table. At least there should be some way of getting sorting column(s) and direction so to force a new select on the backend.
- 主要語言
- Rust
- 星號
- 2.6k
- 分支
- 175
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 43
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
sqlpage/SQLPage 的其他 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 65/100
sqlpage/SQLPage#1218 · 3 則留言 ·
維護者通常 1 天內回覆
-
There is no convenient way to reproduce issues可能已有人在做 @81reap 於 26 天前認領。 未關閉enhancement
sqlpage/SQLPage#1566 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Mutation Testing Results :: Dead Code + Missing Tests可能重新可做 @81reap 於 61 天前認領,目前沒有進行中的 PR。 未關閉
sqlpage/SQLPage#1396 · 5 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
chart: 3D charts未關閉enhancement
難度 5/5 一週以上 新手友好度 25/100
維護者通常 1 天內回覆
相似的 Issue
-
CI/CD ignore-for-release
難度 2/5 1-3 小時 新手友好度 70/100
eclipse-ankaios/ankaios#844 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
std: `SliceIndex<str>` missing for `std::ops` ranges, so generic `R: SliceIndex<str>` bounds fail未關閉
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 70/100
symposium-dev/symposium#530 ·
維護者通常 5 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆